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

from dataclasses import dataclass
from typing import TYPE_CHECKING, Dict, 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 ApiVersion(betterproto.Message):
    """LATEST_API_VERSION=1.0.0-beta.4"""

    major: int = betterproto.uint64_field(1)
    minor: int = betterproto.uint64_field(2)
    patch: int = betterproto.uint64_field(3)
    pre: str = betterproto.string_field(4)
    build: str = betterproto.string_field(5)


@dataclass(eq=False, repr=False)
class ApiVersionRequest(betterproto.Message):
    pass


class ApiVersionServiceStub(betterproto.ServiceStub):
    async def get_api_version(
        self,
        api_version_request: "ApiVersionRequest",
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None
    ) -> "ApiVersion":
        return await self._unary_unary(
            "/braiins.bos.ApiVersionService/GetApiVersion",
            api_version_request,
            ApiVersion,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )


class ApiVersionServiceBase(ServiceBase):
    async def get_api_version(
        self, api_version_request: "ApiVersionRequest"
    ) -> "ApiVersion":
        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)

    async def __rpc_get_api_version(
        self, stream: "grpclib.server.Stream[ApiVersionRequest, ApiVersion]"
    ) -> None:
        request = await stream.recv_message()
        response = await self.get_api_version(request)
        await stream.send_message(response)

    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
        return {
            "/braiins.bos.ApiVersionService/GetApiVersion": grpclib.const.Handler(
                self.__rpc_get_api_version,
                grpclib.const.Cardinality.UNARY_UNARY,
                ApiVersionRequest,
                ApiVersion,
            ),
        }
