"""Worker configuration. Env names match the Laravel app (see design doc appendix)."""
from pydantic_settings import BaseSettings, SettingsConfigDict


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

    database_url: str = "postgresql://aix:aix@localhost/aix"
    storage_driver: str = "local"          # 'local' or 's3'
    storage_root: str = "/tmp/aix-storage"  # local driver only
    s3_endpoint: str | None = None
    s3_bucket: str = "aix"
    s3_key: str | None = None
    s3_secret: str | None = None

    worker_id: str = "worker-local"
    poll_interval_s: float = 5.0           # safety net; LISTEN/NOTIFY wakes us earlier

    # Static image settings (runtime-tunable values live in the `settings` table, see aix.config).
    raster_dpi: int = 200
    jpeg_quality: int = 75
    jpeg_target_kb: int = 300
    ai_image_long_edge: int = 1600
    blank_min_stroke_px: int = 120   # at 200 DPI one small handwritten digit is ~200+ px
    max_pages_per_script: int = 40


settings = Settings()
