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

import temporalio.bridge.client
import temporalio.bridge.proto
import temporalio.bridge.proto.activity_task
import temporalio.bridge.proto.workflow_activation
import temporalio.bridge.proto.workflow_completion
import temporalio.bridge.runtime
import temporalio.bridge.temporal_sdk_bridge
import temporalio.converter
from dataclasses import dataclass
from typing import Optional, TYPE_CHECKING, Tuple
from typing_extensions import TypeAlias

"""
This type stub file was generated by pyright.
"""
@dataclass
class WorkerConfig:
    """Python representation of the Rust struct for configuring a worker."""
    namespace: str
    task_queue: str
    build_id: str
    identity_override: Optional[str]
    max_cached_workflows: int
    max_outstanding_workflow_tasks: int
    max_outstanding_activities: int
    max_outstanding_local_activities: int
    max_concurrent_workflow_task_polls: int
    nonsticky_to_sticky_poll_ratio: float
    max_concurrent_activity_task_polls: int
    no_remote_activities: bool
    sticky_queue_schedule_to_start_timeout_millis: int
    max_heartbeat_throttle_interval_millis: int
    default_heartbeat_throttle_interval_millis: int
    max_activities_per_second: Optional[float]
    max_task_queue_activities_per_second: Optional[float]
    graceful_shutdown_period_millis: int
    use_worker_versioning: bool
    ...


class Worker:
    """SDK Core worker."""
    @staticmethod
    def create(client: temporalio.bridge.client.Client, config: WorkerConfig) -> Worker:
        """Create a bridge worker from a bridge client."""
        ...
    
    @staticmethod
    def for_replay(runtime: temporalio.bridge.runtime.Runtime, config: WorkerConfig) -> Tuple[Worker, temporalio.bridge.temporal_sdk_bridge.HistoryPusher]:
        """Create a bridge replay worker."""
        ...
    
    def __init__(self, ref: temporalio.bridge.temporal_sdk_bridge.WorkerRef) -> None:
        """Create SDK core worker from a bridge worker."""
        ...
    
    async def poll_workflow_activation(self) -> temporalio.bridge.proto.workflow_activation.WorkflowActivation:
        """Poll for a workflow activation."""
        ...
    
    async def poll_activity_task(self) -> temporalio.bridge.proto.activity_task.ActivityTask:
        """Poll for an activity task."""
        ...
    
    async def complete_workflow_activation(self, comp: temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion) -> None:
        """Complete a workflow activation."""
        ...
    
    async def complete_activity_task(self, comp: temporalio.bridge.proto.ActivityTaskCompletion) -> None:
        """Complete an activity task."""
        ...
    
    def record_activity_heartbeat(self, comp: temporalio.bridge.proto.ActivityHeartbeat) -> None:
        """Record an activity heartbeat."""
        ...
    
    def request_workflow_eviction(self, run_id: str) -> None:
        """Request a workflow be evicted."""
        ...
    
    def initiate_shutdown(self) -> None:
        """Start shutdown of the worker."""
        ...
    
    async def finalize_shutdown(self) -> None:
        """Finalize the worker.

        This will fail if shutdown hasn't completed fully due to internal
        reference count checks.
        """
        ...
    


if TYPE_CHECKING:
    PayloadContainer: TypeAlias = ...
else:
    ...
async def decode_activation(act: temporalio.bridge.proto.workflow_activation.WorkflowActivation, codec: temporalio.converter.PayloadCodec) -> None:
    """Decode the given activation with the codec."""
    ...

async def encode_completion(comp: temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion, codec: temporalio.converter.PayloadCodec) -> None:
    """Recursively encode the given completion with the codec."""
    ...

