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

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

import betterproto
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 GetInfoRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class GetInfoResponse(betterproto.Message):
    implementation: "ImplementationDetails" = betterproto.message_field(1)
    capabilities: List[str] = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class ImplementationDetails(betterproto.Message):
    name: str = betterproto.string_field(1)
    version: str = betterproto.string_field(2)
    url: str = betterproto.string_field(3)


class InfoServiceStub(betterproto.ServiceStub):
    async def get_info(
        self,
        get_info_request: "GetInfoRequest",
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None
    ) -> "GetInfoResponse":
        return await self._unary_unary(
            "/io.qualang.api.v1.InfoService/GetInfo",
            get_info_request,
            GetInfoResponse,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )


class InfoServiceBase(ServiceBase):
    async def get_info(self, get_info_request: "GetInfoRequest") -> "GetInfoResponse":
        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)

    async def __rpc_get_info(
        self, stream: "grpclib.server.Stream[GetInfoRequest, GetInfoResponse]"
    ) -> None:
        request = await stream.recv_message()
        response = await self.get_info(request)
        await stream.send_message(response)

    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
        return {
            "/io.qualang.api.v1.InfoService/GetInfo": grpclib.const.Handler(
                self.__rpc_get_info,
                grpclib.const.Cardinality.UNARY_UNARY,
                GetInfoRequest,
                GetInfoResponse,
            ),
        }
