from pydantic import Field
from pydantic_settings import BaseSettings


class MailSettings(BaseSettings):
    host: str = Field(default="smtp.yandex.com")
    port: int = Field(default=587)
    login: str = Field(default="info@service-laboratory.online")
    password: str = Field(default="superPassword")

    class Config:
        env_prefix = "MAIL_"


class OpenApiSettings(BaseSettings):
    title: str = Field(deafult="title")
    version: str = Field(deafult="0.1.2")
    path: str = Field(deafult="/api/docs")

    class Config:
        env_prefix = "OPEN_API_"


class Settings(BaseSettings):
    db_url: str = Field(default="postgresql+asyncpg://user:password@localhost:5432/db")
    jwt_secret: str = Field(default="secret_for_jwt")
    open_api_config: OpenApiSettings = Field(default_factory=OpenApiSettings)
    mail_config: MailSettings = Field(default_factory=MailSettings)


settings = Settings()
