# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: service.proto
# plugin: python-betterproto
# This file has been @generated

__all__ = (
    "DoThingRequest",
    "DoThingResponse",
    "TestStub",
    "TestBase",
)


from dataclasses import dataclass
from typing import (
    TYPE_CHECKING,
    Dict,
    List,
    Optional,
)

import grpclib

import betterproto
from betterproto.grpc.grpclib_server import ServiceBase


if TYPE_CHECKING:
    import grpclib.server
    from grpclib.metadata import Deadline

    from betterproto.grpc.grpclib_client import MetadataLike


@dataclass(eq=False, repr=False)
class DoThingRequest(betterproto.Message):
    """ """

    name: str = betterproto.string_field(1)
    """
    
    """

    comments: List[str] = betterproto.string_field(2)
    """
    
    """


@dataclass(eq=False, repr=False)
class DoThingResponse(betterproto.Message):
    """ """

    names: List[str] = betterproto.string_field(1)
    """
    
    """


class TestStub(betterproto.ServiceStub):
    """ """

    async def do_thing(
        self,
        do_thing_request: "DoThingRequest",
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None,
    ) -> "DoThingResponse":
        """ """

        return await self._unary_unary(
            "/service_uppercase.Test/DoThing",
            do_thing_request,
            DoThingResponse,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )


class TestBase(ServiceBase):
    """ """

    async def do_thing(self, do_thing_request: "DoThingRequest") -> "DoThingResponse":
        """ """

        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)

    async def __rpc_do_thing(
        self, stream: "grpclib.server.Stream[DoThingRequest, DoThingResponse]"
    ) -> None:
        request = await stream.recv_message()
        response = await self.do_thing(request)
        await stream.send_message(response)

    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
        return {
            "/service_uppercase.Test/DoThing": grpclib.const.Handler(
                self.__rpc_do_thing,
                grpclib.const.Cardinality.UNARY_UNARY,
                DoThingRequest,
                DoThingResponse,
            ),
        }
