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


class ExternalIdentityAuthService(Protocol):
    async def get_pending_external_identity(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def create_external_identity_account(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def confirm_external_identity_link(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")

    async def cancel_external_identity_flow(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class ExternalIdentityAuthServiceASGIApplication(ConnectASGIApplication[ExternalIdentityAuthService]):
    def __init__(self, service: ExternalIdentityAuthService | AsyncGenerator[ExternalIdentityAuthService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            service=service,
            endpoints=lambda svc: {
                "/chatto.auth.v1.ExternalIdentityAuthService/GetPendingExternalIdentity": Endpoint.unary(
                    method=MethodInfo(
                        name="GetPendingExternalIdentity",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.get_pending_external_identity,
                ),
                "/chatto.auth.v1.ExternalIdentityAuthService/CreateExternalIdentityAccount": Endpoint.unary(
                    method=MethodInfo(
                        name="CreateExternalIdentityAccount",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.create_external_identity_account,
                ),
                "/chatto.auth.v1.ExternalIdentityAuthService/ConfirmExternalIdentityLink": Endpoint.unary(
                    method=MethodInfo(
                        name="ConfirmExternalIdentityLink",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.confirm_external_identity_link,
                ),
                "/chatto.auth.v1.ExternalIdentityAuthService/CancelExternalIdentityFlow": Endpoint.unary(
                    method=MethodInfo(
                        name="CancelExternalIdentityFlow",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.cancel_external_identity_flow,
                ),
            },
            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.auth.v1.ExternalIdentityAuthService"


class ExternalIdentityAuthServiceClient(ConnectClient):
    async def get_pending_external_identity(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetPendingExternalIdentity",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def create_external_identity_account(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="CreateExternalIdentityAccount",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def confirm_external_identity_link(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ConfirmExternalIdentityLink",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def cancel_external_identity_flow(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="CancelExternalIdentityFlow",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )


class ExternalIdentityAuthServiceSync(Protocol):
    def get_pending_external_identity(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def create_external_identity_account(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def confirm_external_identity_link(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
    def cancel_external_identity_flow(self, request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest, ctx: RequestContext) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse:
        raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")


class ExternalIdentityAuthServiceWSGIApplication(ConnectWSGIApplication):
    def __init__(self, service: ExternalIdentityAuthServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None:
        super().__init__(
            endpoints={
                "/chatto.auth.v1.ExternalIdentityAuthService/GetPendingExternalIdentity": EndpointSync.unary(
                    method=MethodInfo(
                        name="GetPendingExternalIdentity",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.get_pending_external_identity,
                ),
                "/chatto.auth.v1.ExternalIdentityAuthService/CreateExternalIdentityAccount": EndpointSync.unary(
                    method=MethodInfo(
                        name="CreateExternalIdentityAccount",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.create_external_identity_account,
                ),
                "/chatto.auth.v1.ExternalIdentityAuthService/ConfirmExternalIdentityLink": EndpointSync.unary(
                    method=MethodInfo(
                        name="ConfirmExternalIdentityLink",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.confirm_external_identity_link,
                ),
                "/chatto.auth.v1.ExternalIdentityAuthService/CancelExternalIdentityFlow": EndpointSync.unary(
                    method=MethodInfo(
                        name="CancelExternalIdentityFlow",
                        service_name="chatto.auth.v1.ExternalIdentityAuthService",
                        input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest,
                        output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.cancel_external_identity_flow,
                ),
            },
            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.auth.v1.ExternalIdentityAuthService"


class ExternalIdentityAuthServiceClientSync(ConnectClientSync):
    def get_pending_external_identity(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="GetPendingExternalIdentity",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.GetPendingExternalIdentityResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def create_external_identity_account(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="CreateExternalIdentityAccount",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CreateExternalIdentityAccountResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def confirm_external_identity_link(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ConfirmExternalIdentityLink",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.ConfirmExternalIdentityLinkResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    def cancel_external_identity_flow(
        self,
        request: chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="CancelExternalIdentityFlow",
                service_name="chatto.auth.v1.ExternalIdentityAuthService",
                input=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowRequest,
                output=chatto_dot_auth_dot_v1_dot_external__identity__auth__pb2.CancelExternalIdentityFlowResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
