# 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.executioncontext.v1 import api_pb2 as ai_dot_stigmer_dot_agentic_dot_executioncontext_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 ExecutionContextCommandControllerStub(object):
    """ExecutionContextCommandController provides write operations for ExecutionContext resources.

    Authorization: All RPCs use is_skip_authorization with custom handler-level derived auth.
    ExecutionContext is ephemeral (1:1 with its parent execution) and has no dedicated
    FGA model. Authorization is derived from the parent execution:
    - create: Caller must have can_edit on parent agent_execution or workflow_execution
    - delete: Caller must have can_edit on parent agent_execution or workflow_execution

    This avoids FGA tuple churn for short-lived resources while maintaining proper access control.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.apply = channel.unary_unary(
                '/ai.stigmer.agentic.executioncontext.v1.ExecutionContextCommandController/apply',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.FromString,
                _registered_method=True)
        self.create = channel.unary_unary(
                '/ai.stigmer.agentic.executioncontext.v1.ExecutionContextCommandController/create',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.FromString,
                _registered_method=True)
        self.delete = channel.unary_unary(
                '/ai.stigmer.agentic.executioncontext.v1.ExecutionContextCommandController/delete',
                request_serializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceDeleteInput.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.FromString,
                _registered_method=True)


class ExecutionContextCommandControllerServicer(object):
    """ExecutionContextCommandController provides write operations for ExecutionContext resources.

    Authorization: All RPCs use is_skip_authorization with custom handler-level derived auth.
    ExecutionContext is ephemeral (1:1 with its parent execution) and has no dedicated
    FGA model. Authorization is derived from the parent execution:
    - create: Caller must have can_edit on parent agent_execution or workflow_execution
    - delete: Caller must have can_edit on parent agent_execution or workflow_execution

    This avoids FGA tuple churn for short-lived resources while maintaining proper access control.
    """

    def apply(self, request, context):
        """Create or update an ExecutionContext.
        The authorization and state-operation are determined depending on whether the execution context
        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 ExecutionContext (called by execution pipeline on behalf of the user).
        Handler-level derived auth: checks can_edit on parent agent_execution or workflow_execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def delete(self, request, context):
        """Delete an ExecutionContext (called when execution completes).
        Handler-level derived auth: checks can_edit on parent agent_execution or workflow_execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ExecutionContextCommandControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'apply': grpc.unary_unary_rpc_method_handler(
                    servicer.apply,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
            ),
            'create': grpc.unary_unary_rpc_method_handler(
                    servicer.create,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
            ),
            'delete': grpc.unary_unary_rpc_method_handler(
                    servicer.delete,
                    request_deserializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceDeleteInput.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.agentic.executioncontext.v1.ExecutionContextCommandController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.agentic.executioncontext.v1.ExecutionContextCommandController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class ExecutionContextCommandController(object):
    """ExecutionContextCommandController provides write operations for ExecutionContext resources.

    Authorization: All RPCs use is_skip_authorization with custom handler-level derived auth.
    ExecutionContext is ephemeral (1:1 with its parent execution) and has no dedicated
    FGA model. Authorization is derived from the parent execution:
    - create: Caller must have can_edit on parent agent_execution or workflow_execution
    - delete: Caller must have can_edit on parent agent_execution or workflow_execution

    This avoids FGA tuple churn for short-lived resources while maintaining proper access control.
    """

    @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.executioncontext.v1.ExecutionContextCommandController/apply',
            ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.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.executioncontext.v1.ExecutionContextCommandController/create',
            ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.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.executioncontext.v1.ExecutionContextCommandController/delete',
            ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.ApiResourceDeleteInput.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_executioncontext_dot_v1_dot_api__pb2.ExecutionContext.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
