"""
Workflow-safe proxy classes for the julee domain.

This module contains all @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.
"""

from julee.contrib.ceap.domain.repositories.assembly import AssemblyRepository
from julee.contrib.ceap.domain.repositories.assembly_specification import (
    AssemblySpecificationRepository,
)
from julee.contrib.ceap.domain.repositories.document import DocumentRepository
from julee.contrib.ceap.domain.repositories.document_policy_validation import (
    DocumentPolicyValidationRepository,
)
from julee.contrib.ceap.domain.repositories.knowledge_service_config import (
    KnowledgeServiceConfigRepository,
)
from julee.contrib.ceap.domain.repositories.knowledge_service_query import (
    KnowledgeServiceQueryRepository,
)
from julee.contrib.ceap.domain.repositories.policy import PolicyRepository

# Import activity name bases from shared module
from julee.repositories.temporal.activity_names import (
    ASSEMBLY_ACTIVITY_BASE,
    ASSEMBLY_SPECIFICATION_ACTIVITY_BASE,
    DOCUMENT_ACTIVITY_BASE,
    DOCUMENT_POLICY_VALIDATION_ACTIVITY_BASE,
    KNOWLEDGE_SERVICE_CONFIG_ACTIVITY_BASE,
    KNOWLEDGE_SERVICE_QUERY_ACTIVITY_BASE,
    POLICY_ACTIVITY_BASE,
)
from julee.util.temporal.decorators import temporal_workflow_proxy


@temporal_workflow_proxy(
    activity_base=ASSEMBLY_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowAssemblyRepositoryProxy(AssemblyRepository):
    """
    Workflow implementation of AssemblyRepository that calls activities.
    All methods are automatically generated by the @temporal_workflow_proxy
    decorator.
    """

    pass


@temporal_workflow_proxy(
    activity_base=ASSEMBLY_SPECIFICATION_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowAssemblySpecificationRepositoryProxy(AssemblySpecificationRepository):
    """
    Workflow implementation of AssemblySpecificationRepository that calls
    activities.
    All methods are automatically generated by the @temporal_workflow_proxy
    decorator.
    """

    pass


@temporal_workflow_proxy(
    activity_base=DOCUMENT_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowDocumentRepositoryProxy(DocumentRepository):
    """
    Workflow implementation of DocumentRepository that calls activities.
    All methods are automatically generated by the @temporal_workflow_proxy
    decorator.
    """

    pass


@temporal_workflow_proxy(
    activity_base=KNOWLEDGE_SERVICE_CONFIG_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowKnowledgeServiceConfigRepositoryProxy(KnowledgeServiceConfigRepository):
    """
    Workflow implementation of KnowledgeServiceConfigRepository that calls
    activities.
    All methods are automatically generated by the @temporal_workflow_proxy
    decorator.
    """

    pass


@temporal_workflow_proxy(
    activity_base=KNOWLEDGE_SERVICE_QUERY_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowKnowledgeServiceQueryRepositoryProxy(KnowledgeServiceQueryRepository):
    """
    Workflow implementation of KnowledgeServiceQueryRepository that calls
    activities. All methods are automatically generated by the
    @temporal_workflow_proxy decorator.
    """

    pass


@temporal_workflow_proxy(
    activity_base=POLICY_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowPolicyRepositoryProxy(PolicyRepository):
    """
    Workflow implementation of PolicyRepository that calls activities.
    All methods are automatically generated by the @temporal_workflow_proxy
    decorator.
    """

    pass


@temporal_workflow_proxy(
    activity_base=DOCUMENT_POLICY_VALIDATION_ACTIVITY_BASE,
    default_timeout_seconds=30,
    retry_methods=["save", "generate_id"],
)
class WorkflowDocumentPolicyValidationRepositoryProxy(
    DocumentPolicyValidationRepository
):
    """
    Workflow implementation of DocumentPolicyValidationRepository that calls
    activities. All methods are automatically generated by the
    @temporal_workflow_proxy decorator.
    """

    pass


# Export the workflow proxy classes
__all__ = [
    "WorkflowAssemblyRepositoryProxy",
    "WorkflowAssemblySpecificationRepositoryProxy",
    "WorkflowDocumentRepositoryProxy",
    "WorkflowKnowledgeServiceConfigRepositoryProxy",
    "WorkflowKnowledgeServiceQueryRepositoryProxy",
]
