"""
Workflow-safe proxy classes for the polling contrib module.

This module contains @temporal_workflow_proxy decorated classes that
delegate to Temporal activities from within workflows. These classes are
isolated from backend imports to avoid Temporal's workflow sandbox
restrictions.

The proxy classes automatically generate methods that call
workflow.execute_activity() with the appropriate activity names, timeouts,
and retry policies.

This keeps all polling-temporal integration within the contrib module,
maintaining proper dependency direction (contrib imports from core, not vice versa).
"""

from julee.util.temporal.decorators import temporal_workflow_proxy

from ...domain.services.poller import PollerService
from .activity_names import POLLING_SERVICE_ACTIVITY_BASE


@temporal_workflow_proxy(
    activity_base=POLLING_SERVICE_ACTIVITY_BASE,
    default_timeout_seconds=60,  # Shorter timeout for HTTP calls
    retry_methods=["poll_endpoint"],  # Only poll_endpoint needs retries
)
class WorkflowPollerServiceProxy(PollerService):
    """
    Workflow implementation of PollerService that calls activities.
    All methods are automatically generated by the @temporal_workflow_proxy
    decorator.

    This proxy allows workflows to call polling operations through Temporal
    activities, providing durability and retry capabilities for polling
    operations within workflow contexts.
    """

    pass


# Export the workflow proxy class
__all__ = [
    "WorkflowPollerServiceProxy",
]
