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

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

import betterproto
import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
import grpclib
from betterproto.grpc.grpclib_server import ServiceBase


if TYPE_CHECKING:
    import grpclib.server
    from betterproto.grpc.grpclib_client import MetadataLike
    from grpclib.metadata import Deadline


@dataclass(eq=False, repr=False)
class FileDescriptorsRequest(betterproto.Message):
    """FileDescriptorsRequest is the Query/FileDescriptors request type."""

    pass


@dataclass(eq=False, repr=False)
class FileDescriptorsResponse(betterproto.Message):
    """FileDescriptorsResponse is the Query/FileDescriptors response type."""

    files: List["betterproto_lib_google_protobuf.FileDescriptorProto"] = (
        betterproto.message_field(1)
    )
    """files is the file descriptors."""


class ReflectionServiceStub(betterproto.ServiceStub):
    async def file_descriptors(
        self,
        file_descriptors_request: "FileDescriptorsRequest",
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None
    ) -> "FileDescriptorsResponse":
        return await self._unary_unary(
            "/cosmos.reflection.v1.ReflectionService/FileDescriptors",
            file_descriptors_request,
            FileDescriptorsResponse,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )


class ReflectionServiceBase(ServiceBase):

    async def file_descriptors(
        self, file_descriptors_request: "FileDescriptorsRequest"
    ) -> "FileDescriptorsResponse":
        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)

    async def __rpc_file_descriptors(
        self,
        stream: "grpclib.server.Stream[FileDescriptorsRequest, FileDescriptorsResponse]",
    ) -> None:
        request = await stream.recv_message()
        response = await self.file_descriptors(request)
        await stream.send_message(response)

    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
        return {
            "/cosmos.reflection.v1.ReflectionService/FileDescriptors": grpclib.const.Handler(
                self.__rpc_file_descriptors,
                grpclib.const.Cardinality.UNARY_UNARY,
                FileDescriptorsRequest,
                FileDescriptorsResponse,
            ),
        }
