from pydantic_settings import BaseSettings, SettingsConfigDict


class Configs(BaseSettings):
    """
    MongoDB configuration settings.
    """

    USER: str = ""
    PASSWORD: str = ""
    HOST: str = ""
    PORT: int = 0
    DB: str = ""
    ENGINE: str = ""

    @property
    def url(self):
        """Generate the database URL."""
        return f"{self.ENGINE}://{self.USER}:{self.PASSWORD}@{self.HOST}:{self.PORT}/{self.DB}?retryWrites=true&w=majority"

    model_config = SettingsConfigDict(env_prefix="MONGO_")


mongo_configs = Configs()  #  singleton instance of the MONGODB configuration settings
