# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from ai.stigmer.agentic.mcpserver.v1 import api_pb2 as ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2
from ai.stigmer.commons.apiresource import io_pb2 as ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2


class McpServerQueryControllerStub(object):
    """McpServerQueryController provides read operations for MCP server resources.
    All read operations require appropriate authorization based on the resource's scope.

    Authorization model:
    - Platform-scoped: Anyone can view (public marketplace)
    - Organization-scoped: Org members can view
    - Identity-account-scoped: Only the owner can view
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.get = channel.unary_unary(
                '/ai.stigmer.agentic.mcpserver.v1.McpServerQueryController/get',
                request_serializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceId.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2.McpServer.FromString,
                _registered_method=True)
        self.getByReference = channel.unary_unary(
                '/ai.stigmer.agentic.mcpserver.v1.McpServerQueryController/getByReference',
                request_serializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceReference.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2.McpServer.FromString,
                _registered_method=True)


class McpServerQueryControllerServicer(object):
    """McpServerQueryController provides read operations for MCP server resources.
    All read operations require appropriate authorization based on the resource's scope.

    Authorization model:
    - Platform-scoped: Anyone can view (public marketplace)
    - Organization-scoped: Org members can view
    - Identity-account-scoped: Only the owner can view
    """

    def get(self, request, context):
        """Get an MCP server by its unique identifier.

        Input: ApiResourceId containing the MCP server's system-generated ID.
        Returns: The full McpServer resource including metadata, spec, and status.

        Authorization: Requires can_view permission on the mcp_server resource.
        The caller must have access based on the resource's scope:
        - Platform: All authenticated users
        - Organization: Organization members
        - Identity Account: Only the owner
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getByReference(self, request, context):
        """Get an MCP server by reference (scope + org + slug).

        Input: ApiResourceReference with scope, org (if applicable), kind, and slug.
        Returns: The full McpServer resource.

        This is the preferred method for looking up MCP servers by name/slug
        rather than system-generated ID. Useful for:
        - Resolving references from Agent.mcp_server_usages
        - CLI lookups by name
        - Cross-scope resolution (platform vs org vs personal)

        Authorization: Custom authorization in handler.
        The handler performs scope-aware authorization based on the reference.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_McpServerQueryControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'get': grpc.unary_unary_rpc_method_handler(
                    servicer.get,
                    request_deserializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceId.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2.McpServer.SerializeToString,
            ),
            'getByReference': grpc.unary_unary_rpc_method_handler(
                    servicer.getByReference,
                    request_deserializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceReference.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2.McpServer.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.agentic.mcpserver.v1.McpServerQueryController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.agentic.mcpserver.v1.McpServerQueryController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class McpServerQueryController(object):
    """McpServerQueryController provides read operations for MCP server resources.
    All read operations require appropriate authorization based on the resource's scope.

    Authorization model:
    - Platform-scoped: Anyone can view (public marketplace)
    - Organization-scoped: Org members can view
    - Identity-account-scoped: Only the owner can view
    """

    @staticmethod
    def get(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/ai.stigmer.agentic.mcpserver.v1.McpServerQueryController/get',
            ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceId.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2.McpServer.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def getByReference(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/ai.stigmer.agentic.mcpserver.v1.McpServerQueryController/getByReference',
            ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceReference.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_mcpserver_dot_v1_dot_api__pb2.McpServer.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
