# -*- coding: utf-8 -*-
# Generated by https://github.com/i2y/connecpy/protoc-gen-connecpy.  DO NOT EDIT!
# source: olympicslocationagent.proto

from typing import Any, Protocol, Union

import httpx

from connecpy.async_client import AsyncConnecpyClient
from connecpy.base import Endpoint
from connecpy.server import ConnecpyServer
from connecpy.client import ConnecpyClient
from connecpy.context import ClientContext, ServiceContext

import olympicslocationagent_pb2 as _pb2

from google.protobuf import symbol_database

_sym_db = symbol_database.Default()


class OlympicsLocationAgent(Protocol):
    async def Ask(
        self, req: _pb2.Olympics, ctx: ServiceContext
    ) -> _pb2.CityLocation: ...


class OlympicsLocationAgentServer(ConnecpyServer):
    def __init__(self, *, service: OlympicsLocationAgent, server_path_prefix=""):
        super().__init__()
        self._prefix = (
            f"{server_path_prefix}/olympicslocationagent.v1.OlympicsLocationAgent"
        )
        self._endpoints = {
            "Ask": Endpoint[_pb2.Olympics, _pb2.CityLocation](
                service_name="OlympicsLocationAgent",
                name="Ask",
                function=getattr(service, "Ask"),
                input=_pb2.Olympics,
                output=_pb2.CityLocation,
            ),
        }

    def serviceName(self):
        return "olympicslocationagent.v1.OlympicsLocationAgent"


class OlympicsLocationAgentClient(ConnecpyClient):
    def Ask(
        self,
        *,
        request: _pb2.Olympics,
        ctx: ClientContext,
        server_path_prefix: str = "",
        **kwargs,
    ) -> _pb2.CityLocation:
        return self._make_request(
            url=f"{server_path_prefix}/olympicslocationagent.v1.OlympicsLocationAgent/Ask",
            ctx=ctx,
            request=request,
            response_obj=_pb2.CityLocation,
            **kwargs,
        )


class AsyncOlympicsLocationAgentClient(AsyncConnecpyClient):
    async def Ask(
        self,
        *,
        request: _pb2.Olympics,
        ctx: ClientContext,
        server_path_prefix: str = "",
        session: Union[httpx.AsyncClient, None] = None,
        **kwargs,
    ) -> _pb2.CityLocation:
        return await self._make_request(
            url=f"{server_path_prefix}/olympicslocationagent.v1.OlympicsLocationAgent/Ask",
            ctx=ctx,
            request=request,
            response_obj=_pb2.CityLocation,
            session=session,
            **kwargs,
        )
