"""Feature flags for experimental and progressive rollout features."""

from typing import Annotated

from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict

from noteflow.config.settings._base import ENV_FILE, EXTRA_IGNORE


class FeatureFlags(BaseSettings):
    """Feature flags for experimental and progressive rollout features.

    Environment variables use NOTEFLOW_FEATURE_ prefix:
        NOTEFLOW_FEATURE_TEMPLATES_ENABLED: Enable summary templates (default: True)
        NOTEFLOW_FEATURE_PDF_EXPORT_ENABLED: Enable PDF export (default: True)
        NOTEFLOW_FEATURE_NER_ENABLED: Enable named entity recognition (default: False)
        NOTEFLOW_FEATURE_CALENDAR_ENABLED: Enable calendar integration (default: False)
        NOTEFLOW_FEATURE_WEBHOOKS_ENABLED: Enable webhook notifications (default: True)
    """

    model_config = SettingsConfigDict(
        env_prefix="NOTEFLOW_FEATURE_",
        env_file=ENV_FILE,
        env_file_encoding="utf-8",
        extra=EXTRA_IGNORE,
    )

    templates_enabled: Annotated[
        bool,
        Field(default=True, description="Enable summary templates feature"),
    ]
    pdf_export_enabled: Annotated[
        bool,
        Field(default=True, description="Enable PDF export (requires weasyprint)"),
    ]
    ner_enabled: Annotated[
        bool,
        Field(default=False, description="Enable NER extraction (requires spacy model download)"),
    ]
    calendar_enabled: Annotated[
        bool,
        Field(default=False, description="Enable calendar integration (requires OAuth setup)"),
    ]
    webhooks_enabled: Annotated[
        bool,
        Field(default=True, description="Enable webhook notifications"),
    ]
