# -*- coding: utf-8 -*-
# Generated by https://github.com/connectrpc/connect-python.  DO NOT EDIT!
# source: chatto/api/v1/notification_preferences.proto

from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping
from typing import Protocol

from connectrpc.client import ConnectClient, ConnectClientSync
from connectrpc.code import Code
from connectrpc.compression import Compression
from connectrpc.errors import ConnectError
from connectrpc.interceptor import Interceptor, InterceptorSync
from connectrpc.method import IdempotencyLevel, MethodInfo
from connectrpc.request import Headers, RequestContext
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync
import chatto.api.v1.notification_preferences_pb2 as chatto_dot_api_dot_v1_dot_notification__preferences__pb2


class NotificationPreferencesService(Protocol):
    async def get_server_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def update_server_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def get_room_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def update_room_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class NotificationPreferencesServiceASGIApplication(ConnectASGIApplication[NotificationPreferencesService]):
    def __init__(self, service: NotificationPreferencesService | AsyncGenerator[NotificationPreferencesService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            service=service,
            endpoints=lambda svc: {
                "/chatto.api.v1.NotificationPreferencesService/GetServerNotificationPreference": Endpoint.unary(
                    method=MethodInfo(
                        name="GetServerNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.get_server_notification_preference,
                ),
                "/chatto.api.v1.NotificationPreferencesService/UpdateServerNotificationPreference": Endpoint.unary(
                    method=MethodInfo(
                        name="UpdateServerNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.update_server_notification_preference,
                ),
                "/chatto.api.v1.NotificationPreferencesService/GetRoomNotificationPreference": Endpoint.unary(
                    method=MethodInfo(
                        name="GetRoomNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.get_room_notification_preference,
                ),
                "/chatto.api.v1.NotificationPreferencesService/UpdateRoomNotificationPreference": Endpoint.unary(
                    method=MethodInfo(
                        name="UpdateRoomNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.update_room_notification_preference,
                ),
            },
            interceptors=interceptors,
            read_max_bytes=read_max_bytes,
            compressions=compressions,
        )

    @property
    def path(self) -> str:
        """Returns the URL path to mount the application to when serving multiple applications."""
        return "/chatto.api.v1.NotificationPreferencesService"


class NotificationPreferencesServiceClient(ConnectClient):
    async def get_server_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetServerNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def update_server_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="UpdateServerNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def get_room_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetRoomNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def update_room_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="UpdateRoomNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )


class NotificationPreferencesServiceSync(Protocol):
    def get_server_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def update_server_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def get_room_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def update_room_notification_preference(self, request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class NotificationPreferencesServiceWSGIApplication(ConnectWSGIApplication):
    def __init__(self, service: NotificationPreferencesServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            endpoints={
                "/chatto.api.v1.NotificationPreferencesService/GetServerNotificationPreference": EndpointSync.unary(
                    method=MethodInfo(
                        name="GetServerNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.get_server_notification_preference,
                ),
                "/chatto.api.v1.NotificationPreferencesService/UpdateServerNotificationPreference": EndpointSync.unary(
                    method=MethodInfo(
                        name="UpdateServerNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.update_server_notification_preference,
                ),
                "/chatto.api.v1.NotificationPreferencesService/GetRoomNotificationPreference": EndpointSync.unary(
                    method=MethodInfo(
                        name="GetRoomNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.get_room_notification_preference,
                ),
                "/chatto.api.v1.NotificationPreferencesService/UpdateRoomNotificationPreference": EndpointSync.unary(
                    method=MethodInfo(
                        name="UpdateRoomNotificationPreference",
                        service_name="chatto.api.v1.NotificationPreferencesService",
                        input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest,
                        output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.update_room_notification_preference,
                ),
            },
            interceptors=interceptors,
            read_max_bytes=read_max_bytes,
            compressions=compressions,
        )

    @property
    def path(self) -> str:
        """Returns the URL path to mount the application to when serving multiple applications."""
        return "/chatto.api.v1.NotificationPreferencesService"


class NotificationPreferencesServiceClientSync(ConnectClientSync):
    def get_server_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetServerNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetServerNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def update_server_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="UpdateServerNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateServerNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def get_room_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetRoomNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetRoomNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.GetNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def update_room_notification_preference(
        self,
        request: chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="UpdateRoomNotificationPreference",
                service_name="chatto.api.v1.NotificationPreferencesService",
                input=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateRoomNotificationPreferenceRequest,
                output=chatto_dot_api_dot_v1_dot_notification__preferences__pb2.UpdateNotificationPreferenceResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
