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

__all__ = (
    "Input",
    "Output",
    "TestStub",
    "TestBase",
)


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

import grpclib

import betterproto_fw
from betterproto_fw.grpc.grpclib_server import ServiceBase


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

    from betterproto_fw.grpc.grpclib_client import MetadataLike


@dataclass(eq=False, repr=False)
class Input(betterproto_fw.Message):
    """ """

    pass


@dataclass(eq=False, repr=False)
class Output(betterproto_fw.Message):
    """ """

    double_value: Optional[float] = betterproto_fw.message_field(
        1, wraps=betterproto_fw.TYPE_DOUBLE
    )
    """
    
    """

    float_value: Optional[float] = betterproto_fw.message_field(
        2, wraps=betterproto_fw.TYPE_FLOAT
    )
    """
    
    """

    int64_value: Optional[int] = betterproto_fw.message_field(
        3, wraps=betterproto_fw.TYPE_INT64
    )
    """
    
    """

    uint64_value: Optional[int] = betterproto_fw.message_field(
        4, wraps=betterproto_fw.TYPE_UINT64
    )
    """
    
    """

    int32_value: Optional[int] = betterproto_fw.message_field(
        5, wraps=betterproto_fw.TYPE_INT32
    )
    """
    
    """

    uint32_value: Optional[int] = betterproto_fw.message_field(
        6, wraps=betterproto_fw.TYPE_UINT32
    )
    """
    
    """

    bool_value: Optional[bool] = betterproto_fw.message_field(
        7, wraps=betterproto_fw.TYPE_BOOL
    )
    """
    
    """

    string_value: Optional[str] = betterproto_fw.message_field(
        8, wraps=betterproto_fw.TYPE_STRING
    )
    """
    
    """

    bytes_value: Optional[bytes] = betterproto_fw.message_field(
        9, wraps=betterproto_fw.TYPE_BYTES
    )
    """
    
    """


class TestStub(betterproto_fw.ServiceStub):
    """Tests that wrapped values are supported as part of output message"""

    async def get_output(
        self,
        input: "Input",
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None,
    ) -> "Output":
        """ """

        return await self._unary_unary(
            "/googletypes_response_embedded.Test/getOutput",
            input,
            Output,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )


class TestBase(ServiceBase):
    """Tests that wrapped values are supported as part of output message"""

    async def get_output(self, input: "Input") -> "Output":
        """ """

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

    async def __rpc_get_output(
        self, stream: "grpclib.server.Stream[Input, Output]"
    ) -> None:
        request = await stream.recv_message()
        response = await self.get_output(request)
        await stream.send_message(response)

    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
        return {
            "/googletypes_response_embedded.Test/getOutput": grpclib.const.Handler(
                self.__rpc_get_output,
                grpclib.const.Cardinality.UNARY_UNARY,
                Input,
                Output,
            ),
        }
