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

__all__ = (
    "Enum",
    "Test",
    "ServiceStub",
    "ServiceBase",
)


from dataclasses import dataclass
from typing import (
    TYPE_CHECKING,
    Dict,
    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


class Enum(betterproto.Enum):
    """
    Documentation of enum 1
    other line 1

    Documentation of enum 2
    other line 2

    Documentation of enum 3
    """

    Enum_Variant = 0
    """
    Documentation of variant 1
    other line 1
    
    Documentation of variant 2
    other line 2
    
    Documentation of variant 3
    """


@dataclass(eq=False, repr=False)
class Test(betterproto.Message):
    """
    Documentation of message 1
    other line 1

    Documentation of message 2
    other line 2

    Documentation of message 3
    """

    x: int = betterproto.uint32_field(1)
    """
    Documentation of field 1
    other line 1
    
    Documentation of field 2
    other line 2
    
    Documentation of field 3
    """


class ServiceStub(betterproto.ServiceStub):
    """
    Documentation of service 1
    other line 1

    Documentation of service 2
    other line 2

    Documentation of service 3
    """

    async def get(
        self,
        test: "Test",
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None,
    ) -> "Test":
        """
        Documentation of method 1
        other line 1

        Documentation of method 2
        other line 2

        Documentation of method 3
        """

        return await self._unary_unary(
            "/documentation.Service/get",
            test,
            Test,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )


class ServiceBase(ServiceBase):
    """
    Documentation of service 1
    other line 1

    Documentation of service 2
    other line 2

    Documentation of service 3
    """

    async def get(self, test: "Test") -> "Test":
        """
        Documentation of method 1
        other line 1

        Documentation of method 2
        other line 2

        Documentation of method 3
        """

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

    async def __rpc_get(self, stream: "grpclib.server.Stream[Test, Test]") -> None:
        request = await stream.recv_message()
        response = await self.get(request)
        await stream.send_message(response)

    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
        return {
            "/documentation.Service/get": grpclib.const.Handler(
                self.__rpc_get,
                grpclib.const.Cardinality.UNARY_UNARY,
                Test,
                Test,
            ),
        }
