# 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.skill.v1 import api_pb2 as ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2
from ai.stigmer.agentic.skill.v1 import io_pb2 as ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2
from ai.stigmer.commons.apiresource import io_pb2 as ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2


class SkillCommandControllerStub(object):
    """SkillCommandController handles write operations for skills.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.push = channel.unary_unary(
                '/ai.stigmer.agentic.skill.v1.SkillCommandController/push',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.PushSkillRequest.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
                _registered_method=True)
        self.pushFromExecutionArtifact = channel.unary_unary(
                '/ai.stigmer.agentic.skill.v1.SkillCommandController/pushFromExecutionArtifact',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.PushSkillFromExecutionArtifactRequest.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
                _registered_method=True)
        self.updateVisibility = channel.unary_unary(
                '/ai.stigmer.agentic.skill.v1.SkillCommandController/updateVisibility',
                request_serializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.UpdateVisibilityInput.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
                _registered_method=True)
        self.delete = channel.unary_unary(
                '/ai.stigmer.agentic.skill.v1.SkillCommandController/delete',
                request_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.SkillId.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
                _registered_method=True)


class SkillCommandControllerServicer(object):
    """SkillCommandController handles write operations for skills.
    """

    def push(self, request, context):
        """Push (upload) a skill artifact.
        This operation creates a new skill if it doesn't exist, or creates a new version
        of an existing skill. The skill artifact must contain SKILL.md.

        Authorization:
        - Organization-scoped skills: Caller must have can_create_skill permission in the organization
        - Platform-scoped skills: Caller must be a platform operator (handled automatically by common auth step)

        The backend will:
        1. Normalize the name to a slug
        2. Find or create the skill resource
        3. Extract SKILL.md from the artifact
        4. Calculate SHA256 hash (version identifier)
        5. Store the artifact (deduplicated by hash)
        6. Update skill spec and status
        7. Archive the previous version (if updating)

        Returns: The created or updated Skill resource (consistent with other CRUD operations)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def pushFromExecutionArtifact(self, request, context):
        """Push a skill directly from an execution artifact already in storage.

        This is the server-side equivalent of push() — instead of receiving
        ZIP bytes from the client, it reads an existing directory artifact
        (produced by an agent execution) from artifact storage and pushes
        it as a skill. This avoids downloading the ZIP to the browser and
        re-uploading it, and eliminates CORS concerns for SDK consumers.

        The caller must have can_view on the referenced execution AND
        can_create_skill in the target organization.

        Returns: The created or updated Skill resource
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def updateVisibility(self, request, context):
        """Update the visibility of an existing skill.

        This is a targeted metadata update — it only modifies metadata.visibility,
        leaving spec, status, and other metadata fields untouched. Skills default
        to visibility_private on push; use this RPC to make a skill publicly
        accessible (marketplace-style sharing) or to revoke public access.

        Authorization: Requires can_edit permission on the skill resource.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def delete(self, request, context):
        """Delete a skill and all its versions.
        This removes the skill from the main collection but preserves audit history.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SkillCommandControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'push': grpc.unary_unary_rpc_method_handler(
                    servicer.push,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.PushSkillRequest.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.SerializeToString,
            ),
            'pushFromExecutionArtifact': grpc.unary_unary_rpc_method_handler(
                    servicer.pushFromExecutionArtifact,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.PushSkillFromExecutionArtifactRequest.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.SerializeToString,
            ),
            'updateVisibility': grpc.unary_unary_rpc_method_handler(
                    servicer.updateVisibility,
                    request_deserializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.UpdateVisibilityInput.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.SerializeToString,
            ),
            'delete': grpc.unary_unary_rpc_method_handler(
                    servicer.delete,
                    request_deserializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.SkillId.FromString,
                    response_serializer=ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.agentic.skill.v1.SkillCommandController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.agentic.skill.v1.SkillCommandController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class SkillCommandController(object):
    """SkillCommandController handles write operations for skills.
    """

    @staticmethod
    def push(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.skill.v1.SkillCommandController/push',
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.PushSkillRequest.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def pushFromExecutionArtifact(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.skill.v1.SkillCommandController/pushFromExecutionArtifact',
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.PushSkillFromExecutionArtifactRequest.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def updateVisibility(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.skill.v1.SkillCommandController/updateVisibility',
            ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.UpdateVisibilityInput.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.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.skill.v1.SkillCommandController/delete',
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_io__pb2.SkillId.SerializeToString,
            ai_dot_stigmer_dot_agentic_dot_skill_dot_v1_dot_api__pb2.Skill.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
