import secrets
from typing import Any, Dict, List, Optional, Union

from pydantic import AnyHttpUrl, BaseSettings, EmailStr, HttpUrl, PostgresDsn, validator, DirectoryPath


class Settings(BaseSettings):
    API_V1_STR: str = "/api/v1"
    SECRET_KEY: str = secrets.token_urlsafe(32)
    # 60 minutes * 24 hours * 8 days = 8 days
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
    SERVER_HOST: AnyHttpUrl = "https://cmm.ai:8088"

    PROJECT_NAME = 'ntcri'

    SMTP_TLS: bool = True
    #SMTP_SSL: bool = True         
    SMTP_PORT: Optional[int] = "587"
    SMTP_HOST: Optional[str] = "smtp.gmail.com"
    SMTP_USER: Optional[str] = "zooey@choozmo.com"
    SMTP_PASSWORD: Optional[str] = "bnufmjzkyezputip"
    EMAILS_FROM_EMAIL: Optional[EmailStr] = 'zooey@choozmo.com'
    EMAILS_FROM_NAME: Optional[str] = 'zooey'
    EMAILS_ENABLED: bool = True

    @validator("EMAILS_ENABLED", pre=True, check_fields=False)
    def get_emails_enabled(cls, v: bool, values: Dict[str, Any]) -> bool:
        return bool(
            values.get("SMTP_HOST")
            and values.get("SMTP_PORT")
            and values.get("EMAILS_FROM_EMAIL")
        )
    #EMAIL_TEMPLATES_DIR: str = "C:\/Users\/s1301\/PycharmProjects\/fastdemo\/app\email-templates"
    EMAIL_RESET_TOKEN_EXPIRE_HOURS: int = 48

    CLIENT_ID = "626437744072-q6djn202411is5vdk2v0tu8fo7n07qr0.apps.googleusercontent.com"

settings = Settings()
