from pydantic_settings import BaseSettings, SettingsConfigDict

class Settings(BaseSettings):
    model_config = SettingsConfigDict(env_file=".env", extra="ignore")

    zammad_url: str
    zammad_token: str

    devops_url: str = "https://dev.azure.com"  # override for self-hosted: https://devops.example.com
    devops_org: str
    devops_project: str
    devops_team: str
    devops_pat: str

    anthropic_api_key: str = ""
    openai_api_key: str = ""
    gemini_api_key: str = ""
    ai_provider: str = "anthropic"  # "anthropic", "openai", or "gemini"
    devops_enabled: bool = True
    webhook_secret: str = ""
    webhook_allowed_ips: str = ""   # comma-separated; empty = allow all
    webhook_rate_limit: str = "20/minute"  # slowapi format
    web_username: str = "admin"
    web_password: str = ""
    session_secret: str = ""      # auto-generated per-process if blank
    session_timeout: int = 1800   # seconds; default 30 min
    notifications_enabled: bool = True
    debug: bool = False
    first_comment: str = (
        "Thank you for your message. Your ticket has been received and "
        "logged in our project management system. Our team will review it shortly."
    )

settings = Settings()
