# core/config.py
from pydantic_settings import BaseSettings
import os

DOTENV_PATH = os.path.join(os.path.dirname(__file__), "../.env.local")


class Settings(BaseSettings):
    # Database settings - reads from environment or .env
    DB_PORT: int = 5432
    DB_NAME: str = "maia"
    DB_HOST: str = "localhost"
    DB_USER: str = "maia"
    DB_PASSWORD: str = "maia"

    DB_URL: str = ""

    # Redis settings - reads REDIS_URL from environment or .env, also used for Celery.
    REDIS_URL: str = "redis://localhost:6379/0"

    # JWT settings - reads from environment or .env
    JWT_ALGORITHM: str = "HS256"
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
    REFRESH_TOKEN_EXPIRE_DAYS: int = 7
    PEPPER: str = "pepper"
    JWT_SECRET_KEY: str = "secret"

    # Other settings
    GOOGLE_API_KEY: str
    EXPO_PUSH_API_URL: str = "https://exp.host/--/api/v2/push/send"

    class Config:
        # Tell pydantic-settings to load variables from a .env file
        env_file = DOTENV_PATH
        env_file_encoding = "utf-8"
        extra = "ignore"


# Create a single instance of the settings
settings = Settings()
