"""Validation constant sets shared across the application."""

import os

# Valid status values for features
VALID_FEATURE_STATUSES = {'planned', 'in_progress', 'done', 'cancelled'}

# Valid status values for tasks
VALID_TASK_STATUSES = {'grooming', 'todo', 'in_progress', 'done', 'cancelled', 'timeout', 'merged', 'closed', 'waiting_for_input'}

# Valid status transitions for tasks
VALID_TASK_TRANSITIONS: dict[str, set[str]] = {
    "grooming": {"todo", "cancelled"},
    "todo": {"in_progress", "cancelled", "grooming"},
    "in_progress": {"done", "cancelled", "timeout", "merged", "waiting_for_input"},
    "done": {"merged"},  # PR was merged after agent completed work
    "cancelled": {"todo"},
    "timeout": {"todo"},
    "merged": set(),  # Terminal state — PR was merged
    "closed": {"todo"},  # PR was closed without merging — can be retried
    "waiting_for_input": {"in_progress", "cancelled"},  # Resumed when approval is resolved
}

# Valid priority values for tasks
VALID_PRIORITIES = {'low', 'medium', 'high', 'critical'}

# Valid category values for peon memories
VALID_MEMORY_CATEGORIES = {'env', 'pattern', 'gotcha', 'test', 'dependency', 'general'}

# Maximum number of memories per project (eviction threshold)
MAX_MEMORIES_PER_PROJECT = 50

# Discord bot token — read from environment, used as fallback when not stored in DB
DISCORD_BOT_TOKEN: str = os.environ.get("DISCORD_BOT_TOKEN", "")
