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


class AdminEventLogService(Protocol):
    async def list_events(self, request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def list_event_types(self, request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def get_event(self, request: chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class AdminEventLogServiceASGIApplication(ConnectASGIApplication[AdminEventLogService]):
    def __init__(self, service: AdminEventLogService | AsyncGenerator[AdminEventLogService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            service=service,
            endpoints=lambda svc: {
                "/chatto.admin.v1.AdminEventLogService/ListEvents": Endpoint.unary(
                    method=MethodInfo(
                        name="ListEvents",
                        service_name="chatto.admin.v1.AdminEventLogService",
                        input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest,
                        output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.list_events,
                ),
                "/chatto.admin.v1.AdminEventLogService/ListEventTypes": Endpoint.unary(
                    method=MethodInfo(
                        name="ListEventTypes",
                        service_name="chatto.admin.v1.AdminEventLogService",
                        input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest,
                        output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.list_event_types,
                ),
                "/chatto.admin.v1.AdminEventLogService/GetEvent": Endpoint.unary(
                    method=MethodInfo(
                        name="GetEvent",
                        service_name="chatto.admin.v1.AdminEventLogService",
                        input=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest,
                        output=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.get_event,
                ),
            },
            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.admin.v1.AdminEventLogService"


class AdminEventLogServiceClient(ConnectClient):
    async def list_events(
        self,
        request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListEvents",
                service_name="chatto.admin.v1.AdminEventLogService",
                input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest,
                output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def list_event_types(
        self,
        request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListEventTypes",
                service_name="chatto.admin.v1.AdminEventLogService",
                input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest,
                output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def get_event(
        self,
        request: chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetEvent",
                service_name="chatto.admin.v1.AdminEventLogService",
                input=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest,
                output=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )


class AdminEventLogServiceSync(Protocol):
    def list_events(self, request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def list_event_types(self, request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def get_event(self, request: chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest, ctx: RequestContext) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class AdminEventLogServiceWSGIApplication(ConnectWSGIApplication):
    def __init__(self, service: AdminEventLogServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            endpoints={
                "/chatto.admin.v1.AdminEventLogService/ListEvents": EndpointSync.unary(
                    method=MethodInfo(
                        name="ListEvents",
                        service_name="chatto.admin.v1.AdminEventLogService",
                        input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest,
                        output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.list_events,
                ),
                "/chatto.admin.v1.AdminEventLogService/ListEventTypes": EndpointSync.unary(
                    method=MethodInfo(
                        name="ListEventTypes",
                        service_name="chatto.admin.v1.AdminEventLogService",
                        input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest,
                        output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.list_event_types,
                ),
                "/chatto.admin.v1.AdminEventLogService/GetEvent": EndpointSync.unary(
                    method=MethodInfo(
                        name="GetEvent",
                        service_name="chatto.admin.v1.AdminEventLogService",
                        input=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest,
                        output=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.get_event,
                ),
            },
            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.admin.v1.AdminEventLogService"


class AdminEventLogServiceClientSync(ConnectClientSync):
    def list_events(
        self,
        request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListEvents",
                service_name="chatto.admin.v1.AdminEventLogService",
                input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsRequest,
                output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventsResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def list_event_types(
        self,
        request: chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListEventTypes",
                service_name="chatto.admin.v1.AdminEventLogService",
                input=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesRequest,
                output=chatto_dot_admin_dot_v1_dot_event__log__pb2.ListEventTypesResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def get_event(
        self,
        request: chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetEvent",
                service_name="chatto.admin.v1.AdminEventLogService",
                input=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventRequest,
                output=chatto_dot_admin_dot_v1_dot_event__log__pb2.GetEventResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
