from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import List


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

    ES_URL: str = "http://localhost:9200"
    ES_INDEX: str = "atuacapes"
    ES_USER: str = ""
    ES_PASSWORD: str = ""
    ES_VERIFY_SSL: bool = True

    ORACLE_LOCAL_USER: str = ""
    ORACLE_LOCAL_PASSWORD: str = ""
    ORACLE_LOCAL_DSN: str = ""

    API_HOST: str = "0.0.0.0"
    API_PORT: int = 8000
    API_RELOAD: bool = True

    CORS_ORIGINS: str = "http://localhost:3000,http://localhost:5173"

    LOG_LEVEL: str = "INFO"
    SCHEDULER_ENABLED: bool = False
    SCHEDULER_HOUR: int = 3

    @property
    def cors_origins_list(self) -> List[str]:
        return [origin.strip() for origin in self.CORS_ORIGINS.split(",")]


settings = Settings()
