# 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.agentinstance.v1 import api_pb2 as ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2
from ai.stigmer.agentic.agentinstance.v1 import io_pb2 as ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_io__pb2


class AgentInstanceCommandControllerStub(object):
    """AgentInstanceCommandController handles write operations for agent instances.
    Follows the standard pattern: create, update, delete (no granular field updates).
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.apply = channel.unary_unary(
                '/ai.stigmer.agentic.agentinstance.v1.AgentInstanceCommandController/apply',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                _registered_method=True)
        self.create = channel.unary_unary(
                '/ai.stigmer.agentic.agentinstance.v1.AgentInstanceCommandController/create',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                _registered_method=True)
        self.update = channel.unary_unary(
                '/ai.stigmer.agentic.agentinstance.v1.AgentInstanceCommandController/update',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                _registered_method=True)
        self.delete = channel.unary_unary(
                '/ai.stigmer.agentic.agentinstance.v1.AgentInstanceCommandController/delete',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_io__pb2.AgentInstanceId.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                _registered_method=True)


class AgentInstanceCommandControllerServicer(object):
    """AgentInstanceCommandController handles write operations for agent instances.
    Follows the standard pattern: create, update, delete (no granular field updates).
    """

    def apply(self, request, context):
        """Create or update an agent instance.
        The authorization and state-operation are determined depending on whether the agent instance
        is going to be created or updated which is determined as part of the request execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def create(self, request, context):
        """Create a new agent instance with full state.
        Provide organization_id in metadata.org, and complete spec with configuration and secrets.

        Authorization: Uses FGA contextual tuples (handler-level)
        - Checks can_create_instance on parent agent (via spec.agent_id)
        - For org-scoped: Passes contextual tuple agent#organization@organization:target-org
        - FGA evaluates membership via contextual tuple (single authorization check)

        This pattern eliminates redundant checks by providing organization context to FGA
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def update(self, request, context):
        """Update an instance with full state.
        Used to update entire instance configuration including metadata, spec, and secrets.
        No individual field updates - always provide complete state.
        Authorization: Only owner can update (can_edit permission)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def delete(self, request, context):
        """Delete an agent instance.
        Authorization: Only owner can delete (can_delete permission)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_AgentInstanceCommandControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'apply': grpc.unary_unary_rpc_method_handler(
                    servicer.apply,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ),
            'create': grpc.unary_unary_rpc_method_handler(
                    servicer.create,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ),
            'update': grpc.unary_unary_rpc_method_handler(
                    servicer.update,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ),
            'delete': grpc.unary_unary_rpc_method_handler(
                    servicer.delete,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_io__pb2.AgentInstanceId.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.agentic.agentinstance.v1.AgentInstanceCommandController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.agentic.agentinstance.v1.AgentInstanceCommandController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class AgentInstanceCommandController(object):
    """AgentInstanceCommandController handles write operations for agent instances.
    Follows the standard pattern: create, update, delete (no granular field updates).
    """

    @staticmethod
    def apply(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.agentinstance.v1.AgentInstanceCommandController/apply',
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def create(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.agentinstance.v1.AgentInstanceCommandController/create',
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def update(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.agentinstance.v1.AgentInstanceCommandController/update',
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def delete(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.agentinstance.v1.AgentInstanceCommandController/delete',
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_io__pb2.AgentInstanceId.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_agentinstance_dot_v1_dot_api__pb2.AgentInstance.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
