# -*- coding: utf-8 -*-
# Generated by https://github.com/connectrpc/connect-python.  DO NOT EDIT!
# source: chatto/api/v1/room_directory.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.room_directory_pb2 as chatto_dot_api_dot_v1_dot_room__directory__pb2


class RoomDirectoryService(Protocol):
    async def list_rooms(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def list_room_groups(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def get_room_group(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def batch_get_room_groups(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def get_room(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def batch_get_rooms(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class RoomDirectoryServiceASGIApplication(ConnectASGIApplication[RoomDirectoryService]):
    def __init__(self, service: RoomDirectoryService | AsyncGenerator[RoomDirectoryService], *, 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.RoomDirectoryService/ListRooms": Endpoint.unary(
                    method=MethodInfo(
                        name="ListRooms",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.list_rooms,
                ),
                "/chatto.api.v1.RoomDirectoryService/ListRoomGroups": Endpoint.unary(
                    method=MethodInfo(
                        name="ListRoomGroups",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.list_room_groups,
                ),
                "/chatto.api.v1.RoomDirectoryService/GetRoomGroup": Endpoint.unary(
                    method=MethodInfo(
                        name="GetRoomGroup",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.get_room_group,
                ),
                "/chatto.api.v1.RoomDirectoryService/BatchGetRoomGroups": Endpoint.unary(
                    method=MethodInfo(
                        name="BatchGetRoomGroups",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.batch_get_room_groups,
                ),
                "/chatto.api.v1.RoomDirectoryService/GetRoom": Endpoint.unary(
                    method=MethodInfo(
                        name="GetRoom",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.get_room,
                ),
                "/chatto.api.v1.RoomDirectoryService/BatchGetRooms": Endpoint.unary(
                    method=MethodInfo(
                        name="BatchGetRooms",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.batch_get_rooms,
                ),
            },
            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.RoomDirectoryService"


class RoomDirectoryServiceClient(ConnectClient):
    async def list_rooms(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListRooms",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def list_room_groups(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListRoomGroups",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def get_room_group(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetRoomGroup",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def batch_get_room_groups(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="BatchGetRoomGroups",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def get_room(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetRoom",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def batch_get_rooms(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="BatchGetRooms",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )


class RoomDirectoryServiceSync(Protocol):
    def list_rooms(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def list_room_groups(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def get_room_group(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def batch_get_room_groups(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def get_room(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def batch_get_rooms(self, request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest, ctx: RequestContext) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class RoomDirectoryServiceWSGIApplication(ConnectWSGIApplication):
    def __init__(self, service: RoomDirectoryServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            endpoints={
                "/chatto.api.v1.RoomDirectoryService/ListRooms": EndpointSync.unary(
                    method=MethodInfo(
                        name="ListRooms",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.list_rooms,
                ),
                "/chatto.api.v1.RoomDirectoryService/ListRoomGroups": EndpointSync.unary(
                    method=MethodInfo(
                        name="ListRoomGroups",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.list_room_groups,
                ),
                "/chatto.api.v1.RoomDirectoryService/GetRoomGroup": EndpointSync.unary(
                    method=MethodInfo(
                        name="GetRoomGroup",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.get_room_group,
                ),
                "/chatto.api.v1.RoomDirectoryService/BatchGetRoomGroups": EndpointSync.unary(
                    method=MethodInfo(
                        name="BatchGetRoomGroups",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.batch_get_room_groups,
                ),
                "/chatto.api.v1.RoomDirectoryService/GetRoom": EndpointSync.unary(
                    method=MethodInfo(
                        name="GetRoom",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.get_room,
                ),
                "/chatto.api.v1.RoomDirectoryService/BatchGetRooms": EndpointSync.unary(
                    method=MethodInfo(
                        name="BatchGetRooms",
                        service_name="chatto.api.v1.RoomDirectoryService",
                        input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest,
                        output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.batch_get_rooms,
                ),
            },
            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.RoomDirectoryService"


class RoomDirectoryServiceClientSync(ConnectClientSync):
    def list_rooms(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListRooms",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def list_room_groups(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListRoomGroups",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.ListRoomGroupsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def get_room_group(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetRoomGroup",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomGroupResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def batch_get_room_groups(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="BatchGetRoomGroups",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomGroupsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def get_room(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetRoom",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.GetRoomResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def batch_get_rooms(
        self,
        request: chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="BatchGetRooms",
                service_name="chatto.api.v1.RoomDirectoryService",
                input=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsRequest,
                output=chatto_dot_api_dot_v1_dot_room__directory__pb2.BatchGetRoomsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
