import os

from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    app_name: str = "sino-mci-channel-service"
    debug: bool = os.getenv("DEBUG", "false").lower() == "true"
    host: str = "0.0.0.0"
    port: int = int(os.getenv("PORT", "8000"))
    mci_server_url: str = os.getenv("MCI_SERVER_URL", "http://localhost:8080/msg-platform")
    heartbeat_interval_seconds: int = int(os.getenv("HEARTBEAT_INTERVAL_SECONDS", "30"))
    pywechat_mock_mode: bool = os.getenv("PYWECHAT_MOCK_MODE", "true").lower() == "true"

    event_store_path: str = os.getenv("EVENT_STORE_PATH", "./data/events.db")
    max_retry: int = int(os.getenv("MAX_RETRY", "5"))
    base_retry_delay_seconds: int = int(os.getenv("BASE_RETRY_DELAY_SECONDS", "5"))
    event_retention_days: int = int(os.getenv("EVENT_RETENTION_DAYS", "10"))
    event_publish_interval_seconds: float = float(os.getenv("EVENT_PUBLISH_INTERVAL_SECONDS", "5"))


settings = Settings()
