"""
This type stub file was generated by pyright.
"""

import builtins
import sys
import typing
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import temporalio.api.common.v1.message_pb2
import temporalio.api.failure.v1.message_pb2
import temporalio.api.nexus.v1.message_pb2
import temporalio.api.workflowservice.v1.request_response_pb2

"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""
if sys.version_info >= (3, 10):
    ...
else:
    ...
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class _NexusTaskCancelReason:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType


class _NexusTaskCancelReasonEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_NexusTaskCancelReason.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    TIMED_OUT: _NexusTaskCancelReason.ValueType
    WORKER_SHUTDOWN: _NexusTaskCancelReason.ValueType
    ...


class NexusTaskCancelReason(_NexusTaskCancelReason, metaclass=_NexusTaskCancelReasonEnumTypeWrapper):
    ...


TIMED_OUT: NexusTaskCancelReason.ValueType
WORKER_SHUTDOWN: NexusTaskCancelReason.ValueType
global___NexusTaskCancelReason = NexusTaskCancelReason
class _NexusOperationCancellationType:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType


class _NexusOperationCancellationTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_NexusOperationCancellationType.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    WAIT_CANCELLATION_COMPLETED: _NexusOperationCancellationType.ValueType
    ABANDON: _NexusOperationCancellationType.ValueType
    TRY_CANCEL: _NexusOperationCancellationType.ValueType
    WAIT_CANCELLATION_REQUESTED: _NexusOperationCancellationType.ValueType
    ...


class NexusOperationCancellationType(_NexusOperationCancellationType, metaclass=_NexusOperationCancellationTypeEnumTypeWrapper):
    """Controls at which point to report back to lang when a nexus operation is cancelled"""
    ...


WAIT_CANCELLATION_COMPLETED: NexusOperationCancellationType.ValueType
ABANDON: NexusOperationCancellationType.ValueType
TRY_CANCEL: NexusOperationCancellationType.ValueType
WAIT_CANCELLATION_REQUESTED: NexusOperationCancellationType.ValueType
global___NexusOperationCancellationType = NexusOperationCancellationType
class NexusOperationResult(google.protobuf.message.Message):
    """Used by core to resolve nexus operations."""
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    COMPLETED_FIELD_NUMBER: builtins.int
    FAILED_FIELD_NUMBER: builtins.int
    CANCELLED_FIELD_NUMBER: builtins.int
    TIMED_OUT_FIELD_NUMBER: builtins.int
    @property
    def completed(self) -> temporalio.api.common.v1.message_pb2.Payload:
        ...
    
    @property
    def failed(self) -> temporalio.api.failure.v1.message_pb2.Failure:
        ...
    
    @property
    def cancelled(self) -> temporalio.api.failure.v1.message_pb2.Failure:
        ...
    
    @property
    def timed_out(self) -> temporalio.api.failure.v1.message_pb2.Failure:
        ...
    
    def __init__(self, *, completed: temporalio.api.common.v1.message_pb2.Payload | None = ..., failed: temporalio.api.failure.v1.message_pb2.Failure | None = ..., cancelled: temporalio.api.failure.v1.message_pb2.Failure | None = ..., timed_out: temporalio.api.failure.v1.message_pb2.Failure | None = ...) -> None:
        ...
    
    def HasField(self, field_name: typing_extensions.Literal["cancelled", b"cancelled", "completed", b"completed", "failed", b"failed", "status", b"status", "timed_out", b"timed_out",]) -> builtins.bool:
        ...
    
    def ClearField(self, field_name: typing_extensions.Literal["cancelled", b"cancelled", "completed", b"completed", "failed", b"failed", "status", b"status", "timed_out", b"timed_out",]) -> None:
        ...
    
    def WhichOneof(self, oneof_group: typing_extensions.Literal["status", b"status"]) -> (typing_extensions.Literal["completed", "failed", "cancelled", "timed_out"] | None):
        ...
    


global___NexusOperationResult = NexusOperationResult
class NexusTaskCompletion(google.protobuf.message.Message):
    """A response to a Nexus task"""
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    TASK_TOKEN_FIELD_NUMBER: builtins.int
    COMPLETED_FIELD_NUMBER: builtins.int
    ERROR_FIELD_NUMBER: builtins.int
    ACK_CANCEL_FIELD_NUMBER: builtins.int
    task_token: builtins.bytes
    @property
    def completed(self) -> temporalio.api.nexus.v1.message_pb2.Response:
        """The handler completed (successfully or not). Note that the response kind must match the
        request kind (start or cancel).
        """
        ...
    
    @property
    def error(self) -> temporalio.api.nexus.v1.message_pb2.HandlerError:
        """The handler could not complete the request for some reason."""
        ...
    
    ack_cancel: builtins.bool
    def __init__(self, *, task_token: builtins.bytes = ..., completed: temporalio.api.nexus.v1.message_pb2.Response | None = ..., error: temporalio.api.nexus.v1.message_pb2.HandlerError | None = ..., ack_cancel: builtins.bool = ...) -> None:
        ...
    
    def HasField(self, field_name: typing_extensions.Literal["ack_cancel", b"ack_cancel", "completed", b"completed", "error", b"error", "status", b"status",]) -> builtins.bool:
        ...
    
    def ClearField(self, field_name: typing_extensions.Literal["ack_cancel", b"ack_cancel", "completed", b"completed", "error", b"error", "status", b"status", "task_token", b"task_token",]) -> None:
        ...
    
    def WhichOneof(self, oneof_group: typing_extensions.Literal["status", b"status"]) -> typing_extensions.Literal["completed", "error", "ack_cancel"] | None:
        ...
    


global___NexusTaskCompletion = NexusTaskCompletion
class NexusTask(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    TASK_FIELD_NUMBER: builtins.int
    CANCEL_TASK_FIELD_NUMBER: builtins.int
    @property
    def task(self) -> temporalio.api.workflowservice.v1.request_response_pb2.PollNexusTaskQueueResponse:
        """A nexus task from server"""
        ...
    
    @property
    def cancel_task(self) -> global___CancelNexusTask:
        """A request by Core to notify an in-progress operation handler that it should cancel. This
        is distinct from a `CancelOperationRequest` from the server, which results from the user
        requesting the cancellation of an operation. Handling this variant should result in
        something like cancelling a cancellation token given to the user's operation handler.

        These do not count as a separate task for the purposes of completing all issued tasks,
        but rather count as a sort of modification to the already-issued task which is being
        cancelled.

        EX: Core knows the nexus operation has timed out, and it does not make sense for the
        user's operation handler to continue doing work.
        """
        ...
    
    def __init__(self, *, task: temporalio.api.workflowservice.v1.request_response_pb2.PollNexusTaskQueueResponse | None = ..., cancel_task: global___CancelNexusTask | None = ...) -> None:
        ...
    
    def HasField(self, field_name: typing_extensions.Literal["cancel_task", b"cancel_task", "task", b"task", "variant", b"variant"]) -> builtins.bool:
        ...
    
    def ClearField(self, field_name: typing_extensions.Literal["cancel_task", b"cancel_task", "task", b"task", "variant", b"variant"]) -> None:
        ...
    
    def WhichOneof(self, oneof_group: typing_extensions.Literal["variant", b"variant"]) -> typing_extensions.Literal["task", "cancel_task"] | None:
        ...
    


global___NexusTask = NexusTask
class CancelNexusTask(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor
    TASK_TOKEN_FIELD_NUMBER: builtins.int
    REASON_FIELD_NUMBER: builtins.int
    task_token: builtins.bytes
    reason: global___NexusTaskCancelReason.ValueType
    def __init__(self, *, task_token: builtins.bytes = ..., reason: global___NexusTaskCancelReason.ValueType = ...) -> None:
        ...
    
    def ClearField(self, field_name: typing_extensions.Literal["reason", b"reason", "task_token", b"task_token"]) -> None:
        ...
    


global___CancelNexusTask = CancelNexusTask
