"""
Flyto Core - YAML Workflow Automation Engine

This package provides the core functionality for executing YAML-based workflows.

Key APIs:
- core.validation: Workflow validation (used by flyto-cloud)
- core.catalog: Module catalog (used by flyto-pro LLM)
- core.modules: Module registry and execution
"""
try:
    from importlib.metadata import version as _pkg_version
    __version__ = _pkg_version("flyto-core")
except Exception:
    __version__ = "0.0.0"

from .constants import (
    # Execution defaults
    DEFAULT_MAX_RETRIES,
    DEFAULT_RETRY_DELAY_MS,
    DEFAULT_TIMEOUT_SECONDS,
    DEFAULT_TIMEOUT_MS,
    EXPONENTIAL_BACKOFF_BASE,
    MAX_LOG_RESULT_LENGTH,
    DEFAULT_MAX_TREE_DEPTH,
    # Browser defaults
    DEFAULT_BROWSER_TIMEOUT_MS,
    DEFAULT_VIEWPORT_WIDTH,
    DEFAULT_VIEWPORT_HEIGHT,
    DEFAULT_USER_AGENT,
    # LLM defaults
    OLLAMA_DEFAULT_URL,
    OLLAMA_EMBEDDINGS_ENDPOINT,
    DEFAULT_LLM_MAX_TOKENS,
    # Validation constants
    MIN_DESCRIPTION_LENGTH,
    MAX_DESCRIPTION_LENGTH,
    MAX_TIMEOUT_LIMIT,
    MAX_RETRIES_LIMIT,
    # Classes
    WorkflowStatus,
    APIEndpoints,
    EnvVars,
    ErrorMessages,
)

from .utils import (
    get_api_key,
    validate_api_key,
    validate_required_param,
    get_param,
    auto_convert_type,
    truncate_string,
    ensure_list,
    ensure_dict,
    safe_execute,
    log_execution,
)

__all__ = [
    # Execution Constants
    "DEFAULT_MAX_RETRIES",
    "DEFAULT_RETRY_DELAY_MS",
    "DEFAULT_TIMEOUT_SECONDS",
    "DEFAULT_TIMEOUT_MS",
    "EXPONENTIAL_BACKOFF_BASE",
    "MAX_LOG_RESULT_LENGTH",
    "DEFAULT_MAX_TREE_DEPTH",
    # Browser Constants
    "DEFAULT_BROWSER_TIMEOUT_MS",
    "DEFAULT_VIEWPORT_WIDTH",
    "DEFAULT_VIEWPORT_HEIGHT",
    "DEFAULT_USER_AGENT",
    # LLM Constants
    "OLLAMA_DEFAULT_URL",
    "OLLAMA_EMBEDDINGS_ENDPOINT",
    "DEFAULT_LLM_MAX_TOKENS",
    # Validation Constants
    "MIN_DESCRIPTION_LENGTH",
    "MAX_DESCRIPTION_LENGTH",
    "MAX_TIMEOUT_LIMIT",
    "MAX_RETRIES_LIMIT",
    # Classes
    "WorkflowStatus",
    "APIEndpoints",
    "EnvVars",
    "ErrorMessages",
    # Utils
    "get_api_key",
    "validate_api_key",
    "validate_required_param",
    "get_param",
    "auto_convert_type",
    "truncate_string",
    "ensure_list",
    "ensure_dict",
    "safe_execute",
    "log_execution",
    # Version
    "__version__",
]
