"""
Centralized constants for PinkyClawd.

This module provides all magic numbers and configuration values
used throughout the codebase, ensuring consistency and easy updates.

Usage:
    from pinkyclawd.constants import ARCHIVAL_THRESHOLD_RATIO
    from pinkyclawd.constants.models import get_model_limit
    from pinkyclawd.constants.tools import READ_DEFAULT_LIMIT
"""

from __future__ import annotations

# RLM constants
from pinkyclawd.constants.rlm import (
    # Archival thresholds
    ARCHIVAL_THRESHOLD_RATIO,
    SESSION_END_THRESHOLD_RATIO,
    SESSION_END_MIN_MESSAGES,
    POST_ARCHIVAL_TARGET_RATIO,
    # Semantic search thresholds
    SEMANTIC_SIMILARITY_THRESHOLD,
    PROACTIVE_INJECTION_THRESHOLD,
    ANALYSIS_SIMILARITY_THRESHOLD,
    # Search limits
    MAX_CONTEXT_BLOCKS,
    DEFAULT_SEARCH_RESULTS,
    MAX_SEARCH_RESULTS,
    # Token estimation
    CHARS_PER_TOKEN_TEXT,
    CHARS_PER_TOKEN_CODE,
    CHARS_PER_TOKEN_JSON,
    CHARS_PER_TOKEN_WHITESPACE,
    MESSAGE_ROLE_OVERHEAD,
    TOOL_USE_OVERHEAD,
    TOOL_RESULT_OVERHEAD,
    IMAGE_TOKEN_ESTIMATE,
    DEFAULT_PART_OVERHEAD,
    SPECIAL_CHAR_OVERHEAD_MULTIPLIER,
    # Summarization
    SUMMARY_MAX_TOKENS,
    SUMMARY_TRUNCATION_LENGTH,
    # Embedding dimensions
    EMBEDDING_DIM_OPENAI_SMALL,
    EMBEDDING_DIM_OPENAI_LARGE,
    EMBEDDING_DIM_VOYAGE,
    EMBEDDING_DIM_GOOGLE,
    EMBEDDING_DIM_MISTRAL,
    EMBEDDING_DIM_LOCAL,
    DEFAULT_EMBEDDING_DIM,
    # Graph processing
    MAX_CHUNK_SIZE,
    CHUNK_OVERLAP,
    MIN_CHUNK_SIZE,
)

# Model constants
from pinkyclawd.constants.models import (
    # Context limits
    CLAUDE_3_CONTEXT_LIMIT,
    CLAUDE_SONNET_4_CONTEXT_LIMIT,
    CLAUDE_OPUS_4_CONTEXT_LIMIT,
    CLAUDE_HAIKU_CONTEXT_LIMIT,
    GPT_4_CONTEXT_LIMIT,
    GPT_4_TURBO_CONTEXT_LIMIT,
    GPT_4O_CONTEXT_LIMIT,
    GPT_4O_MINI_CONTEXT_LIMIT,
    GEMINI_PRO_CONTEXT_LIMIT,
    GEMINI_FLASH_CONTEXT_LIMIT,
    DEFAULT_CONTEXT_LIMIT,
    MODEL_LIMITS,
    # Output limits
    DEFAULT_MAX_OUTPUT_TOKENS,
    CLAUDE_MAX_OUTPUT_TOKENS,
    GPT_4_MAX_OUTPUT_TOKENS,
    GEMINI_MAX_OUTPUT_TOKENS,
    # Model identifiers
    DEFAULT_ANTHROPIC_MODEL,
    DEFAULT_OPENAI_MODEL,
    DEFAULT_GOOGLE_MODEL,
    DEFAULT_OPENAI_EMBEDDING_MODEL,
    DEFAULT_VOYAGE_EMBEDDING_MODEL,
    DEFAULT_GOOGLE_EMBEDDING_MODEL,
    DEFAULT_MISTRAL_EMBEDDING_MODEL,
    # API configuration
    ANTHROPIC_API_BASE,
    OPENAI_API_BASE,
    GOOGLE_API_BASE,
    API_TIMEOUT_DEFAULT,
    API_TIMEOUT_STREAM,
    API_MAX_RETRIES,
    API_RETRY_DELAY,
    API_RETRY_BACKOFF,
    # Helper function
    get_model_limit,
)

# Tool constants
from pinkyclawd.constants.tools import (
    # File reading
    READ_DEFAULT_LIMIT,
    READ_MAX_LINE_LENGTH,
    READ_MAX_FILE_SIZE,
    # Output truncation
    TOOL_OUTPUT_MAX_LENGTH,
    DISPLAY_TRUNCATION_LENGTH,
    TRUNCATED_OUTPUT_MAX_LINES,
    # Timeouts
    TOOL_DEFAULT_TIMEOUT,
    TOOL_EXTENDED_TIMEOUT,
    BASH_TIMEOUT_MS,
    BASH_MAX_TIMEOUT_MS,
    # Search and grep
    GREP_DEFAULT_CONTEXT,
    GREP_MAX_MATCHES,
    GLOB_MAX_FILES,
    # Session limits
    SESSION_LIST_LIMIT,
    SESSION_MAX_MESSAGES,
    # Batch operations
    BATCH_MAX_CONCURRENT,
    BATCH_TIMEOUT,
    # Web operations
    WEB_FETCH_TIMEOUT,
    WEB_FETCH_MAX_SIZE,
    WEB_SEARCH_MAX_RESULTS,
    # LSP operations
    LSP_TIMEOUT,
    LSP_MAX_REFERENCES,
    # Permission flags
    PERMISSION_READ,
    PERMISSION_WRITE,
    PERMISSION_EXECUTE,
    PERMISSION_NETWORK,
)

__all__ = [
    # RLM - Archival
    "ARCHIVAL_THRESHOLD_RATIO",
    "SESSION_END_THRESHOLD_RATIO",
    "SESSION_END_MIN_MESSAGES",
    "POST_ARCHIVAL_TARGET_RATIO",
    # RLM - Search
    "SEMANTIC_SIMILARITY_THRESHOLD",
    "PROACTIVE_INJECTION_THRESHOLD",
    "ANALYSIS_SIMILARITY_THRESHOLD",
    "MAX_CONTEXT_BLOCKS",
    "DEFAULT_SEARCH_RESULTS",
    "MAX_SEARCH_RESULTS",
    # RLM - Token estimation
    "CHARS_PER_TOKEN_TEXT",
    "CHARS_PER_TOKEN_CODE",
    "CHARS_PER_TOKEN_JSON",
    "CHARS_PER_TOKEN_WHITESPACE",
    "MESSAGE_ROLE_OVERHEAD",
    "TOOL_USE_OVERHEAD",
    "TOOL_RESULT_OVERHEAD",
    "IMAGE_TOKEN_ESTIMATE",
    "DEFAULT_PART_OVERHEAD",
    "SPECIAL_CHAR_OVERHEAD_MULTIPLIER",
    # RLM - Summarization
    "SUMMARY_MAX_TOKENS",
    "SUMMARY_TRUNCATION_LENGTH",
    # RLM - Embeddings
    "EMBEDDING_DIM_OPENAI_SMALL",
    "EMBEDDING_DIM_OPENAI_LARGE",
    "EMBEDDING_DIM_VOYAGE",
    "EMBEDDING_DIM_GOOGLE",
    "EMBEDDING_DIM_MISTRAL",
    "EMBEDDING_DIM_LOCAL",
    "DEFAULT_EMBEDDING_DIM",
    # RLM - Graph
    "MAX_CHUNK_SIZE",
    "CHUNK_OVERLAP",
    "MIN_CHUNK_SIZE",
    # Models - Context limits
    "CLAUDE_3_CONTEXT_LIMIT",
    "CLAUDE_SONNET_4_CONTEXT_LIMIT",
    "CLAUDE_OPUS_4_CONTEXT_LIMIT",
    "CLAUDE_HAIKU_CONTEXT_LIMIT",
    "GPT_4_CONTEXT_LIMIT",
    "GPT_4_TURBO_CONTEXT_LIMIT",
    "GPT_4O_CONTEXT_LIMIT",
    "GPT_4O_MINI_CONTEXT_LIMIT",
    "GEMINI_PRO_CONTEXT_LIMIT",
    "GEMINI_FLASH_CONTEXT_LIMIT",
    "DEFAULT_CONTEXT_LIMIT",
    "MODEL_LIMITS",
    # Models - Output limits
    "DEFAULT_MAX_OUTPUT_TOKENS",
    "CLAUDE_MAX_OUTPUT_TOKENS",
    "GPT_4_MAX_OUTPUT_TOKENS",
    "GEMINI_MAX_OUTPUT_TOKENS",
    # Models - Identifiers
    "DEFAULT_ANTHROPIC_MODEL",
    "DEFAULT_OPENAI_MODEL",
    "DEFAULT_GOOGLE_MODEL",
    "DEFAULT_OPENAI_EMBEDDING_MODEL",
    "DEFAULT_VOYAGE_EMBEDDING_MODEL",
    "DEFAULT_GOOGLE_EMBEDDING_MODEL",
    "DEFAULT_MISTRAL_EMBEDDING_MODEL",
    # Models - API
    "ANTHROPIC_API_BASE",
    "OPENAI_API_BASE",
    "GOOGLE_API_BASE",
    "API_TIMEOUT_DEFAULT",
    "API_TIMEOUT_STREAM",
    "API_MAX_RETRIES",
    "API_RETRY_DELAY",
    "API_RETRY_BACKOFF",
    "get_model_limit",
    # Tools - File reading
    "READ_DEFAULT_LIMIT",
    "READ_MAX_LINE_LENGTH",
    "READ_MAX_FILE_SIZE",
    # Tools - Output
    "TOOL_OUTPUT_MAX_LENGTH",
    "DISPLAY_TRUNCATION_LENGTH",
    "TRUNCATED_OUTPUT_MAX_LINES",
    # Tools - Timeouts
    "TOOL_DEFAULT_TIMEOUT",
    "TOOL_EXTENDED_TIMEOUT",
    "BASH_TIMEOUT_MS",
    "BASH_MAX_TIMEOUT_MS",
    # Tools - Search
    "GREP_DEFAULT_CONTEXT",
    "GREP_MAX_MATCHES",
    "GLOB_MAX_FILES",
    # Tools - Sessions
    "SESSION_LIST_LIMIT",
    "SESSION_MAX_MESSAGES",
    # Tools - Batch
    "BATCH_MAX_CONCURRENT",
    "BATCH_TIMEOUT",
    # Tools - Web
    "WEB_FETCH_TIMEOUT",
    "WEB_FETCH_MAX_SIZE",
    "WEB_SEARCH_MAX_RESULTS",
    # Tools - LSP
    "LSP_TIMEOUT",
    "LSP_MAX_REFERENCES",
    # Tools - Permissions
    "PERMISSION_READ",
    "PERMISSION_WRITE",
    "PERMISSION_EXECUTE",
    "PERMISSION_NETWORK",
]
