"""
Constants for the aphub ecosystem.
"""

from enum import Enum
from typing import Final


# API version
API_VERSION: Final[str] = "v1"

# Manifest schema version
MANIFEST_API_VERSION: Final[str] = "aipartnerup.com/v1"


class SupportedFramework(str, Enum):
    """Supported AI agent frameworks."""

    AIPARTNERUPFLOW = "aipartnerupflow"
    CREWAI = "crewai"
    LANGCHAIN = "langchain"
    AUTOGPT = "autogpt"
    SEMANTIC_KERNEL = "semantic-kernel"
    DIFY = "dify"
    CUSTOM = "custom"


# Legacy list for backward compatibility
SUPPORTED_FRAMEWORKS: Final[list[str]] = [f.value for f in SupportedFramework]


class SupportedProtocol(str, Enum):
    """Supported communication protocols."""

    MCP = "mcp"    # Model Context Protocol
    A2A = "a2a"    # Agent-to-Agent
    HTTP = "http"  # Standard HTTP/REST


# Legacy list for backward compatibility
SUPPORTED_PROTOCOLS: Final[list[str]] = [p.value for p in SupportedProtocol]


class SupportedKind(str, Enum):
    """Supported resource kinds."""

    AGENT = "Agent"
    SKILL = "Skill"
    WORKFLOW = "Workflow"
    TOOL = "Tool"
    PROMPT = "Prompt"


# Agent name constraints
AGENT_NAME_MIN_LENGTH: Final[int] = 1
AGENT_NAME_MAX_LENGTH: Final[int] = 255
AGENT_NAME_PATTERN: Final[str] = r"^[a-z0-9]([a-z0-9_-]*[a-z0-9])?$"

# Version pattern (semantic versioning)
VERSION_PATTERN: Final[str] = r"^\d+\.\d+\.\d+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$"

# Default tag
DEFAULT_TAG: Final[str] = "latest"

# Pagination defaults
DEFAULT_PAGE_SIZE: Final[int] = 20
MAX_PAGE_SIZE: Final[int] = 100


# LLM Provider constants
class LLMProvider(str, Enum):
    """Supported LLM providers."""

    OPENAI = "openai"
    ANTHROPIC = "anthropic"
    GOOGLE = "google"
    AZURE = "azure"
    LOCAL = "local"


# Transport protocols for MCP
class MCPTransport(str, Enum):
    """MCP transport protocols."""

    SSE = "sse"
    STDIO = "stdio"
    WEBSOCKET = "websocket"
