"""
config.py

Purpose:
  Provide configuration classes and an initializer for the Flask application.
  This keeps `app.py` focused on wiring the app instead of holding config
  details. Production deployments can override environment variables.

Exports:
  - BaseConfig: Default config with safe cookie defaults
  - apply_config(app): Apply configuration, including SECRET_KEY loading
"""

import os


class BaseConfig:
    SESSION_COOKIE_SECURE = True
    SESSION_COOKIE_HTTPONLY = True
    SESSION_COOKIE_SAMESITE = 'Strict'
    PERMANENT_SESSION_LIFETIME = 60 * 60 * 12  # 12 hours


def apply_config(app):
    app.config.from_object(BaseConfig)
    app.secret_key = os.getenv('SECRET_KEY',
        'a4db8c5884908d99e43c30f338778a2d12fbf862418abc5a3104884d3608fcc5ef00c60ec88e92d7f12e4f2a8f80f641c8922fc10472f5b64728d92ccdb6123c'
    )


