"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""

import builtins
import collections.abc
import sys

import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.message
import google.protobuf.timestamp_pb2

import temporalio.api.common.v1.message_pb2
import temporalio.api.enums.v1.nexus_pb2

if sys.version_info >= (3, 8):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

class Failure(google.protobuf.message.Message):
    """A general purpose failure message.
    See: https://github.com/nexus-rpc/api/blob/main/SPEC.md#failure
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class MetadataEntry(google.protobuf.message.Message):
        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        KEY_FIELD_NUMBER: builtins.int
        VALUE_FIELD_NUMBER: builtins.int
        key: builtins.str
        value: builtins.str
        def __init__(
            self,
            *,
            key: builtins.str = ...,
            value: builtins.str = ...,
        ) -> None: ...
        def ClearField(
            self,
            field_name: typing_extensions.Literal["key", b"key", "value", b"value"],
        ) -> None: ...

    MESSAGE_FIELD_NUMBER: builtins.int
    METADATA_FIELD_NUMBER: builtins.int
    DETAILS_FIELD_NUMBER: builtins.int
    message: builtins.str
    @property
    def metadata(
        self,
    ) -> google.protobuf.internal.containers.ScalarMap[builtins.str, builtins.str]: ...
    details: builtins.bytes
    """UTF-8 encoded JSON serializable details."""
    def __init__(
        self,
        *,
        message: builtins.str = ...,
        metadata: collections.abc.Mapping[builtins.str, builtins.str] | None = ...,
        details: builtins.bytes = ...,
    ) -> None: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "details", b"details", "message", b"message", "metadata", b"metadata"
        ],
    ) -> None: ...

global___Failure = Failure

class HandlerError(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    ERROR_TYPE_FIELD_NUMBER: builtins.int
    FAILURE_FIELD_NUMBER: builtins.int
    RETRY_BEHAVIOR_FIELD_NUMBER: builtins.int
    error_type: builtins.str
    """See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors."""
    @property
    def failure(self) -> global___Failure: ...
    retry_behavior: (
        temporalio.api.enums.v1.nexus_pb2.NexusHandlerErrorRetryBehavior.ValueType
    )
    """Retry behavior, defaults to the retry behavior of the error type as defined in the spec."""
    def __init__(
        self,
        *,
        error_type: builtins.str = ...,
        failure: global___Failure | None = ...,
        retry_behavior: temporalio.api.enums.v1.nexus_pb2.NexusHandlerErrorRetryBehavior.ValueType = ...,
    ) -> None: ...
    def HasField(
        self, field_name: typing_extensions.Literal["failure", b"failure"]
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "error_type",
            b"error_type",
            "failure",
            b"failure",
            "retry_behavior",
            b"retry_behavior",
        ],
    ) -> None: ...

global___HandlerError = HandlerError

class UnsuccessfulOperationError(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    OPERATION_STATE_FIELD_NUMBER: builtins.int
    FAILURE_FIELD_NUMBER: builtins.int
    operation_state: builtins.str
    """See https://github.com/nexus-rpc/api/blob/main/SPEC.md#operationinfo."""
    @property
    def failure(self) -> global___Failure: ...
    def __init__(
        self,
        *,
        operation_state: builtins.str = ...,
        failure: global___Failure | None = ...,
    ) -> None: ...
    def HasField(
        self, field_name: typing_extensions.Literal["failure", b"failure"]
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "failure", b"failure", "operation_state", b"operation_state"
        ],
    ) -> None: ...

global___UnsuccessfulOperationError = UnsuccessfulOperationError

class Link(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    URL_FIELD_NUMBER: builtins.int
    TYPE_FIELD_NUMBER: builtins.int
    url: builtins.str
    """See https://github.com/nexus-rpc/api/blob/main/SPEC.md#links."""
    type: builtins.str
    def __init__(
        self,
        *,
        url: builtins.str = ...,
        type: builtins.str = ...,
    ) -> None: ...
    def ClearField(
        self, field_name: typing_extensions.Literal["type", b"type", "url", b"url"]
    ) -> None: ...

global___Link = Link

class StartOperationRequest(google.protobuf.message.Message):
    """A request to start an operation."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class CallbackHeaderEntry(google.protobuf.message.Message):
        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        KEY_FIELD_NUMBER: builtins.int
        VALUE_FIELD_NUMBER: builtins.int
        key: builtins.str
        value: builtins.str
        def __init__(
            self,
            *,
            key: builtins.str = ...,
            value: builtins.str = ...,
        ) -> None: ...
        def ClearField(
            self,
            field_name: typing_extensions.Literal["key", b"key", "value", b"value"],
        ) -> None: ...

    SERVICE_FIELD_NUMBER: builtins.int
    OPERATION_FIELD_NUMBER: builtins.int
    REQUEST_ID_FIELD_NUMBER: builtins.int
    CALLBACK_FIELD_NUMBER: builtins.int
    PAYLOAD_FIELD_NUMBER: builtins.int
    CALLBACK_HEADER_FIELD_NUMBER: builtins.int
    LINKS_FIELD_NUMBER: builtins.int
    service: builtins.str
    """Name of service to start the operation in."""
    operation: builtins.str
    """Type of operation to start."""
    request_id: builtins.str
    """A request ID that can be used as an idempotentency key."""
    callback: builtins.str
    """Callback URL to call upon completion if the started operation is async."""
    @property
    def payload(self) -> temporalio.api.common.v1.message_pb2.Payload:
        """Full request body from the incoming HTTP request."""
    @property
    def callback_header(
        self,
    ) -> google.protobuf.internal.containers.ScalarMap[builtins.str, builtins.str]:
        """Header that is expected to be attached to the callback request when the operation completes."""
    @property
    def links(
        self,
    ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[
        global___Link
    ]:
        """Links contain caller information and can be attached to the operations started by the handler."""
    def __init__(
        self,
        *,
        service: builtins.str = ...,
        operation: builtins.str = ...,
        request_id: builtins.str = ...,
        callback: builtins.str = ...,
        payload: temporalio.api.common.v1.message_pb2.Payload | None = ...,
        callback_header: collections.abc.Mapping[builtins.str, builtins.str]
        | None = ...,
        links: collections.abc.Iterable[global___Link] | None = ...,
    ) -> None: ...
    def HasField(
        self, field_name: typing_extensions.Literal["payload", b"payload"]
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "callback",
            b"callback",
            "callback_header",
            b"callback_header",
            "links",
            b"links",
            "operation",
            b"operation",
            "payload",
            b"payload",
            "request_id",
            b"request_id",
            "service",
            b"service",
        ],
    ) -> None: ...

global___StartOperationRequest = StartOperationRequest

class CancelOperationRequest(google.protobuf.message.Message):
    """A request to cancel an operation."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    SERVICE_FIELD_NUMBER: builtins.int
    OPERATION_FIELD_NUMBER: builtins.int
    OPERATION_ID_FIELD_NUMBER: builtins.int
    OPERATION_TOKEN_FIELD_NUMBER: builtins.int
    service: builtins.str
    """Service name."""
    operation: builtins.str
    """Type of operation to cancel."""
    operation_id: builtins.str
    """Operation ID as originally generated by a Handler.

    Deprecated. Renamed to operation_token.
    """
    operation_token: builtins.str
    """Operation token as originally generated by a Handler."""
    def __init__(
        self,
        *,
        service: builtins.str = ...,
        operation: builtins.str = ...,
        operation_id: builtins.str = ...,
        operation_token: builtins.str = ...,
    ) -> None: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "operation",
            b"operation",
            "operation_id",
            b"operation_id",
            "operation_token",
            b"operation_token",
            "service",
            b"service",
        ],
    ) -> None: ...

global___CancelOperationRequest = CancelOperationRequest

class Request(google.protobuf.message.Message):
    """A Nexus request."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class HeaderEntry(google.protobuf.message.Message):
        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        KEY_FIELD_NUMBER: builtins.int
        VALUE_FIELD_NUMBER: builtins.int
        key: builtins.str
        value: builtins.str
        def __init__(
            self,
            *,
            key: builtins.str = ...,
            value: builtins.str = ...,
        ) -> None: ...
        def ClearField(
            self,
            field_name: typing_extensions.Literal["key", b"key", "value", b"value"],
        ) -> None: ...

    HEADER_FIELD_NUMBER: builtins.int
    SCHEDULED_TIME_FIELD_NUMBER: builtins.int
    START_OPERATION_FIELD_NUMBER: builtins.int
    CANCEL_OPERATION_FIELD_NUMBER: builtins.int
    @property
    def header(
        self,
    ) -> google.protobuf.internal.containers.ScalarMap[builtins.str, builtins.str]:
        """Headers extracted from the original request in the Temporal frontend.
        When using Nexus over HTTP, this includes the request's HTTP headers ignoring multiple values.
        """
    @property
    def scheduled_time(self) -> google.protobuf.timestamp_pb2.Timestamp:
        """The timestamp when the request was scheduled in the frontend.
        (-- api-linter: core::0142::time-field-names=disabled
            aip.dev/not-precedent: Not following linter rules. --)
        """
    @property
    def start_operation(self) -> global___StartOperationRequest: ...
    @property
    def cancel_operation(self) -> global___CancelOperationRequest: ...
    def __init__(
        self,
        *,
        header: collections.abc.Mapping[builtins.str, builtins.str] | None = ...,
        scheduled_time: google.protobuf.timestamp_pb2.Timestamp | None = ...,
        start_operation: global___StartOperationRequest | None = ...,
        cancel_operation: global___CancelOperationRequest | None = ...,
    ) -> None: ...
    def HasField(
        self,
        field_name: typing_extensions.Literal[
            "cancel_operation",
            b"cancel_operation",
            "scheduled_time",
            b"scheduled_time",
            "start_operation",
            b"start_operation",
            "variant",
            b"variant",
        ],
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "cancel_operation",
            b"cancel_operation",
            "header",
            b"header",
            "scheduled_time",
            b"scheduled_time",
            "start_operation",
            b"start_operation",
            "variant",
            b"variant",
        ],
    ) -> None: ...
    def WhichOneof(
        self, oneof_group: typing_extensions.Literal["variant", b"variant"]
    ) -> typing_extensions.Literal["start_operation", "cancel_operation"] | None: ...

global___Request = Request

class StartOperationResponse(google.protobuf.message.Message):
    """Response variant for StartOperationRequest."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class Sync(google.protobuf.message.Message):
        """An operation completed successfully."""

        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        PAYLOAD_FIELD_NUMBER: builtins.int
        LINKS_FIELD_NUMBER: builtins.int
        @property
        def payload(self) -> temporalio.api.common.v1.message_pb2.Payload: ...
        @property
        def links(
            self,
        ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[
            global___Link
        ]: ...
        def __init__(
            self,
            *,
            payload: temporalio.api.common.v1.message_pb2.Payload | None = ...,
            links: collections.abc.Iterable[global___Link] | None = ...,
        ) -> None: ...
        def HasField(
            self, field_name: typing_extensions.Literal["payload", b"payload"]
        ) -> builtins.bool: ...
        def ClearField(
            self,
            field_name: typing_extensions.Literal[
                "links", b"links", "payload", b"payload"
            ],
        ) -> None: ...

    class Async(google.protobuf.message.Message):
        """The operation will complete asynchronously.
        The returned ID can be used to reference this operation.
        """

        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        OPERATION_ID_FIELD_NUMBER: builtins.int
        LINKS_FIELD_NUMBER: builtins.int
        OPERATION_TOKEN_FIELD_NUMBER: builtins.int
        operation_id: builtins.str
        """Deprecated. Renamed to operation_token."""
        @property
        def links(
            self,
        ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[
            global___Link
        ]: ...
        operation_token: builtins.str
        def __init__(
            self,
            *,
            operation_id: builtins.str = ...,
            links: collections.abc.Iterable[global___Link] | None = ...,
            operation_token: builtins.str = ...,
        ) -> None: ...
        def ClearField(
            self,
            field_name: typing_extensions.Literal[
                "links",
                b"links",
                "operation_id",
                b"operation_id",
                "operation_token",
                b"operation_token",
            ],
        ) -> None: ...

    SYNC_SUCCESS_FIELD_NUMBER: builtins.int
    ASYNC_SUCCESS_FIELD_NUMBER: builtins.int
    OPERATION_ERROR_FIELD_NUMBER: builtins.int
    @property
    def sync_success(self) -> global___StartOperationResponse.Sync: ...
    @property
    def async_success(self) -> global___StartOperationResponse.Async: ...
    @property
    def operation_error(self) -> global___UnsuccessfulOperationError:
        """The operation completed unsuccessfully (failed or canceled)."""
    def __init__(
        self,
        *,
        sync_success: global___StartOperationResponse.Sync | None = ...,
        async_success: global___StartOperationResponse.Async | None = ...,
        operation_error: global___UnsuccessfulOperationError | None = ...,
    ) -> None: ...
    def HasField(
        self,
        field_name: typing_extensions.Literal[
            "async_success",
            b"async_success",
            "operation_error",
            b"operation_error",
            "sync_success",
            b"sync_success",
            "variant",
            b"variant",
        ],
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "async_success",
            b"async_success",
            "operation_error",
            b"operation_error",
            "sync_success",
            b"sync_success",
            "variant",
            b"variant",
        ],
    ) -> None: ...
    def WhichOneof(
        self, oneof_group: typing_extensions.Literal["variant", b"variant"]
    ) -> (
        typing_extensions.Literal["sync_success", "async_success", "operation_error"]
        | None
    ): ...

global___StartOperationResponse = StartOperationResponse

class CancelOperationResponse(google.protobuf.message.Message):
    """Response variant for CancelOperationRequest."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    def __init__(
        self,
    ) -> None: ...

global___CancelOperationResponse = CancelOperationResponse

class Response(google.protobuf.message.Message):
    """A response indicating that the handler has successfully processed a request."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    START_OPERATION_FIELD_NUMBER: builtins.int
    CANCEL_OPERATION_FIELD_NUMBER: builtins.int
    @property
    def start_operation(self) -> global___StartOperationResponse: ...
    @property
    def cancel_operation(self) -> global___CancelOperationResponse: ...
    def __init__(
        self,
        *,
        start_operation: global___StartOperationResponse | None = ...,
        cancel_operation: global___CancelOperationResponse | None = ...,
    ) -> None: ...
    def HasField(
        self,
        field_name: typing_extensions.Literal[
            "cancel_operation",
            b"cancel_operation",
            "start_operation",
            b"start_operation",
            "variant",
            b"variant",
        ],
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "cancel_operation",
            b"cancel_operation",
            "start_operation",
            b"start_operation",
            "variant",
            b"variant",
        ],
    ) -> None: ...
    def WhichOneof(
        self, oneof_group: typing_extensions.Literal["variant", b"variant"]
    ) -> typing_extensions.Literal["start_operation", "cancel_operation"] | None: ...

global___Response = Response

class Endpoint(google.protobuf.message.Message):
    """A cluster-global binding from an endpoint ID to a target for dispatching incoming Nexus requests."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    VERSION_FIELD_NUMBER: builtins.int
    ID_FIELD_NUMBER: builtins.int
    SPEC_FIELD_NUMBER: builtins.int
    CREATED_TIME_FIELD_NUMBER: builtins.int
    LAST_MODIFIED_TIME_FIELD_NUMBER: builtins.int
    URL_PREFIX_FIELD_NUMBER: builtins.int
    version: builtins.int
    """Data version for this endpoint, incremented for every update issued via the UpdateNexusEndpoint API."""
    id: builtins.str
    """Unique server-generated endpoint ID."""
    @property
    def spec(self) -> global___EndpointSpec:
        """Spec for the endpoint."""
    @property
    def created_time(self) -> google.protobuf.timestamp_pb2.Timestamp:
        """The date and time when the endpoint was created.
        (-- api-linter: core::0142::time-field-names=disabled
            aip.dev/not-precedent: Not following linter rules. --)
        """
    @property
    def last_modified_time(self) -> google.protobuf.timestamp_pb2.Timestamp:
        """The date and time when the endpoint was last modified.
        Will not be set if the endpoint has never been modified.
        (-- api-linter: core::0142::time-field-names=disabled
            aip.dev/not-precedent: Not following linter rules. --)
        """
    url_prefix: builtins.str
    """Server exposed URL prefix for invocation of operations on this endpoint.
    This doesn't include the protocol, hostname or port as the server does not know how it should be accessed
    publicly. The URL is stable in the face of endpoint renames.
    """
    def __init__(
        self,
        *,
        version: builtins.int = ...,
        id: builtins.str = ...,
        spec: global___EndpointSpec | None = ...,
        created_time: google.protobuf.timestamp_pb2.Timestamp | None = ...,
        last_modified_time: google.protobuf.timestamp_pb2.Timestamp | None = ...,
        url_prefix: builtins.str = ...,
    ) -> None: ...
    def HasField(
        self,
        field_name: typing_extensions.Literal[
            "created_time",
            b"created_time",
            "last_modified_time",
            b"last_modified_time",
            "spec",
            b"spec",
        ],
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "created_time",
            b"created_time",
            "id",
            b"id",
            "last_modified_time",
            b"last_modified_time",
            "spec",
            b"spec",
            "url_prefix",
            b"url_prefix",
            "version",
            b"version",
        ],
    ) -> None: ...

global___Endpoint = Endpoint

class EndpointSpec(google.protobuf.message.Message):
    """Contains mutable fields for an Endpoint."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    NAME_FIELD_NUMBER: builtins.int
    DESCRIPTION_FIELD_NUMBER: builtins.int
    TARGET_FIELD_NUMBER: builtins.int
    name: builtins.str
    """Endpoint name, unique for this cluster. Must match `[a-zA-Z_][a-zA-Z0-9_]*`.
    Renaming an endpoint breaks all workflow callers that reference this endpoint, causing operations to fail.
    """
    @property
    def description(self) -> temporalio.api.common.v1.message_pb2.Payload:
        """Markdown description serialized as a single JSON string.
        If the Payload is encrypted, the UI and CLI may decrypt with the configured codec server endpoint.
        By default, the server enforces a limit of 20,000 bytes for this entire payload.
        """
    @property
    def target(self) -> global___EndpointTarget:
        """Target to route requests to."""
    def __init__(
        self,
        *,
        name: builtins.str = ...,
        description: temporalio.api.common.v1.message_pb2.Payload | None = ...,
        target: global___EndpointTarget | None = ...,
    ) -> None: ...
    def HasField(
        self,
        field_name: typing_extensions.Literal[
            "description", b"description", "target", b"target"
        ],
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "description", b"description", "name", b"name", "target", b"target"
        ],
    ) -> None: ...

global___EndpointSpec = EndpointSpec

class EndpointTarget(google.protobuf.message.Message):
    """Target to route requests to."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class Worker(google.protobuf.message.Message):
        """Target a worker polling on a Nexus task queue in a specific namespace."""

        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        NAMESPACE_FIELD_NUMBER: builtins.int
        TASK_QUEUE_FIELD_NUMBER: builtins.int
        namespace: builtins.str
        """Namespace to route requests to."""
        task_queue: builtins.str
        """Nexus task queue to route requests to."""
        def __init__(
            self,
            *,
            namespace: builtins.str = ...,
            task_queue: builtins.str = ...,
        ) -> None: ...
        def ClearField(
            self,
            field_name: typing_extensions.Literal[
                "namespace", b"namespace", "task_queue", b"task_queue"
            ],
        ) -> None: ...

    class External(google.protobuf.message.Message):
        """Target an external server by URL.
        At a later point, this will support providing credentials, in the meantime, an http.RoundTripper can be injected
        into the server to modify the request.
        """

        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        URL_FIELD_NUMBER: builtins.int
        url: builtins.str
        """URL to call."""
        def __init__(
            self,
            *,
            url: builtins.str = ...,
        ) -> None: ...
        def ClearField(
            self, field_name: typing_extensions.Literal["url", b"url"]
        ) -> None: ...

    WORKER_FIELD_NUMBER: builtins.int
    EXTERNAL_FIELD_NUMBER: builtins.int
    @property
    def worker(self) -> global___EndpointTarget.Worker: ...
    @property
    def external(self) -> global___EndpointTarget.External: ...
    def __init__(
        self,
        *,
        worker: global___EndpointTarget.Worker | None = ...,
        external: global___EndpointTarget.External | None = ...,
    ) -> None: ...
    def HasField(
        self,
        field_name: typing_extensions.Literal[
            "external", b"external", "variant", b"variant", "worker", b"worker"
        ],
    ) -> builtins.bool: ...
    def ClearField(
        self,
        field_name: typing_extensions.Literal[
            "external", b"external", "variant", b"variant", "worker", b"worker"
        ],
    ) -> None: ...
    def WhichOneof(
        self, oneof_group: typing_extensions.Literal["variant", b"variant"]
    ) -> typing_extensions.Literal["worker", "external"] | None: ...

global___EndpointTarget = EndpointTarget
