# Generated from soulfire/recipe.proto. DO NOT EDIT.
# Generated by protoc-gen-connectrpc-py v0.11.1 with parameter "protobuf=google".
# ruff: noqa: PGH004
# ruff: noqa
# fmt: off

from __future__ import annotations

from typing import Protocol, TYPE_CHECKING

from connectrpc.client import ConnectClient, ConnectClientSync
from connectrpc.code import Code
from connectrpc.compat import google_protobuf_binary_codec, google_protobuf_codecs
from connectrpc.compression.gzip import GzipCompression
from connectrpc.errors import ConnectError
from connectrpc.method import IdempotencyLevel, MethodInfo
from connectrpc.protocol import ProtocolType
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync
from pyqwest import Client, SyncClient

from .recipe_pb2 import CanCraftRequest, CanCraftResponse, ListRecipesRequest, ListRecipesResponse, ListVillagerTradesRequest, ListVillagerTradesResponse

if TYPE_CHECKING:
    from collections.abc import AsyncGenerator, Iterable, Mapping

    from connectrpc.codec import Codec
    from connectrpc.compression import Compression
    from connectrpc.interceptor import Interceptor, InterceptorSync
    from connectrpc.request import Headers, RequestContext



_DEFAULT_CODECS = google_protobuf_codecs()
_PROTO_BINARY_CODEC = google_protobuf_binary_codec()
_GZIP_COMPRESSION = GzipCompression()

class RecipeService(Protocol):
    async def list_recipes(self, request: ListRecipesRequest, ctx: RequestContext[ListRecipesRequest, ListRecipesResponse]) -> ListRecipesResponse:
        raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')

    async def can_craft(self, request: CanCraftRequest, ctx: RequestContext[CanCraftRequest, CanCraftResponse]) -> CanCraftResponse:
        raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')

    async def list_villager_trades(self, request: ListVillagerTradesRequest, ctx: RequestContext[ListVillagerTradesRequest, ListVillagerTradesResponse]) -> ListVillagerTradesResponse:
        raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')


class RecipeServiceASGIApplication(ConnectASGIApplication[RecipeService]):
    def __init__(
        self,
        service: RecipeService | AsyncGenerator[RecipeService],
        *,
        interceptors: Iterable[Interceptor] = (),
        read_max_bytes: int | None = None,
        compressions: Iterable[Compression] | None = None,
        codecs: Iterable[Codec] | None = _DEFAULT_CODECS,
    ) -> None:
        super().__init__(
            service=service,
            endpoints=lambda svc: {
                "/soulfire.v1.RecipeService/ListRecipes": Endpoint.unary(
                    method=MethodInfo(
                        name="ListRecipes",
                        service_name="soulfire.v1.RecipeService",
                        input=ListRecipesRequest,
                        output=ListRecipesResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.list_recipes,
                ),
                "/soulfire.v1.RecipeService/CanCraft": Endpoint.unary(
                    method=MethodInfo(
                        name="CanCraft",
                        service_name="soulfire.v1.RecipeService",
                        input=CanCraftRequest,
                        output=CanCraftResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.can_craft,
                ),
                "/soulfire.v1.RecipeService/ListVillagerTrades": Endpoint.unary(
                    method=MethodInfo(
                        name="ListVillagerTrades",
                        service_name="soulfire.v1.RecipeService",
                        input=ListVillagerTradesRequest,
                        output=ListVillagerTradesResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=svc.list_villager_trades,
                ),
            },
            interceptors=interceptors,
            read_max_bytes=read_max_bytes,
            compressions=compressions,
            codecs=codecs,
        )

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


class RecipeServiceClient(ConnectClient):
    def __init__(
        self,
        address: str,
        *,
        codec: Codec | None = _PROTO_BINARY_CODEC,
        protocol: ProtocolType = ProtocolType.CONNECT,
        accept_compression: Iterable[Compression] | None = None,
        send_compression: Compression | None = _GZIP_COMPRESSION,
        timeout_ms: int | None = None,
        read_max_bytes: int | None = None,
        interceptors: Iterable[Interceptor] = (),
        http_client: Client | None = None,
    ) -> None:
        super().__init__(
            address=address,
            codec=codec,
            protocol=protocol,
            accept_compression=accept_compression,
            send_compression=send_compression,
            timeout_ms=timeout_ms,
            read_max_bytes=read_max_bytes,
            interceptors=interceptors,
            http_client=http_client,
        )
    async def list_recipes(
        self,
        request: ListRecipesRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> ListRecipesResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListRecipes",
                service_name="soulfire.v1.RecipeService",
                input=ListRecipesRequest,
                output=ListRecipesResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def can_craft(
        self,
        request: CanCraftRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> CanCraftResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="CanCraft",
                service_name="soulfire.v1.RecipeService",
                input=CanCraftRequest,
                output=CanCraftResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

    async def list_villager_trades(
        self,
        request: ListVillagerTradesRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> ListVillagerTradesResponse:
        return await self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListVillagerTrades",
                service_name="soulfire.v1.RecipeService",
                input=ListVillagerTradesRequest,
                output=ListVillagerTradesResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )

class RecipeServiceSync(Protocol):
    def list_recipes(self, request: ListRecipesRequest, ctx: RequestContext[ListRecipesRequest, ListRecipesResponse]) -> ListRecipesResponse:
        raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')

    def can_craft(self, request: CanCraftRequest, ctx: RequestContext[CanCraftRequest, CanCraftResponse]) -> CanCraftResponse:
        raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')

    def list_villager_trades(self, request: ListVillagerTradesRequest, ctx: RequestContext[ListVillagerTradesRequest, ListVillagerTradesResponse]) -> ListVillagerTradesResponse:
        raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')


class RecipeServiceWSGIApplication(ConnectWSGIApplication):
    def __init__(
        self,
        service: RecipeServiceSync,
        interceptors: Iterable[InterceptorSync] = (),
        read_max_bytes: int | None = None,
        compressions: Iterable[Compression] | None = None,
        codecs: Iterable[Codec] | None = _DEFAULT_CODECS,
    ) -> None:
        super().__init__(
            endpoints={
                "/soulfire.v1.RecipeService/ListRecipes": EndpointSync.unary(
                    method=MethodInfo(
                        name="ListRecipes",
                        service_name="soulfire.v1.RecipeService",
                        input=ListRecipesRequest,
                        output=ListRecipesResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.list_recipes,
                ),
                "/soulfire.v1.RecipeService/CanCraft": EndpointSync.unary(
                    method=MethodInfo(
                        name="CanCraft",
                        service_name="soulfire.v1.RecipeService",
                        input=CanCraftRequest,
                        output=CanCraftResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.can_craft,
                ),
                "/soulfire.v1.RecipeService/ListVillagerTrades": EndpointSync.unary(
                    method=MethodInfo(
                        name="ListVillagerTrades",
                        service_name="soulfire.v1.RecipeService",
                        input=ListVillagerTradesRequest,
                        output=ListVillagerTradesResponse,
                        idempotency_level=IdempotencyLevel.UNKNOWN,
                    ),
                    function=service.list_villager_trades,
                ),
            },
            interceptors=interceptors,
            read_max_bytes=read_max_bytes,
            compressions=compressions,
            codecs=codecs,
        )

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


class RecipeServiceClientSync(ConnectClientSync):
    def __init__(
        self,
        address: str,
        *,
        codec: Codec | None = _PROTO_BINARY_CODEC,
        protocol: ProtocolType = ProtocolType.CONNECT,
        accept_compression: Iterable[Compression] | None = None,
        send_compression: Compression | None = _GZIP_COMPRESSION,
        timeout_ms: int | None = None,
        read_max_bytes: int | None = None,
        interceptors: Iterable[InterceptorSync] = (),
        http_client: SyncClient | None = None,
    ) -> None:
        super().__init__(
            address=address,
            codec=codec,
            protocol=protocol,
            accept_compression=accept_compression,
            send_compression=send_compression,
            timeout_ms=timeout_ms,
            read_max_bytes=read_max_bytes,
            interceptors=interceptors,
            http_client=http_client,
        )
    def list_recipes(
        self,
        request: ListRecipesRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> ListRecipesResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListRecipes",
                service_name="soulfire.v1.RecipeService",
                input=ListRecipesRequest,
                output=ListRecipesResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
    def can_craft(
        self,
        request: CanCraftRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> CanCraftResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="CanCraft",
                service_name="soulfire.v1.RecipeService",
                input=CanCraftRequest,
                output=CanCraftResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
    def list_villager_trades(
        self,
        request: ListVillagerTradesRequest,
        *,
        headers: Headers | Mapping[str, str] | None = None,
        timeout_ms: int | None = None,
    ) -> ListVillagerTradesResponse:
        return self.execute_unary(
            request=request,
            method=MethodInfo(
                name="ListVillagerTrades",
                service_name="soulfire.v1.RecipeService",
                input=ListVillagerTradesRequest,
                output=ListVillagerTradesResponse,
                idempotency_level=IdempotencyLevel.UNKNOWN,
            ),
            headers=headers,
            timeout_ms=timeout_ms,
        )
