import datetime


class Config:
    INSECURE_PATHS = [
        "/",
        "/metrics",
        "/openapi.json",
        "/docs",
        "/redoc",
        "/auth/login",
        "/favicon.ico",
        "/docs/oauth2-redirect",
        "/authentication/select",
        "/authentication/login",
        "/authentication/logout",
        "/authentication/refresher",
        "/authentication/refresh",
        "/authentication/disconnect",
        "/authentication/create_password",
        "/authentication/reset_password",
        "/authentication/forgot",
        "/authentication/valid",
    ]
    NOT_SECURE_PATHS = [
        "/access/endpoints/available",
        "/access/endpoint/available",
        "/validations/endpoint",
        "/authentication/avatar",
    ]

    APP_NAME = "evyos-web-api-gateway"
    TITLE = "WAG API Web Api Gateway"
    DESCRIPTION = "This api is serves as web api gateway only to evyos web services."
    APP_URL = "https://www.wag.eys.gen.tr"


class ApiStatic:
    PLACEHOLDER = "https://s.tmimgcdn.com/scr/800x500/276800/building-home-nature-logo-vector-template-3_276851-original.jpg"
    FORGOT_LINK = "https://www.evyos.com.tr/password/create?tokenUrl="
    BLACKLIST_LINK = "https://www.evyos.com.tr/support/unknown-login-notice/"
    APP_DIR = "/home/berkay/git-evyos/api-managment-backend/"

    @classmethod
    def forgot_link(cls, forgot_key):
        return cls.FORGOT_LINK + forgot_key

    @classmethod
    def blacklist_login(cls, record_id):
        return cls.BLACKLIST_LINK + record_id


class Auth:
    ACCESS_EMAIL_EXT = "evyos.com.tr"
    ACCESS_TOKEN_TAG = "evyos-session-key"
    REFRESHER_TOKEN_TAG = "eys_token_refresher"
    SECRET_KEY_72 = (
        "t3sUAmjTGeTgDc6dAUrB41u2SNg0ZHzj4HTjem95y3fRH1nZXOHIBj163kib6iLybT0gLaxq"
    )
    SECRET_KEY_96 = "7ct8VpiwaP1hR2bVSet4dEEAgepuTZUOnO1QxOgKyDqBR2PkqNhcubSrbUUigQKoQA1PBoeeQn5ZCo24pESmVtKs76nA4EKq"
    SECRET_KEY_144 = (
        "R2p5Rq6KCr6PCfjFYUeH1keF2VWHFEuqINVjBGGnvRA2m10pYUKqfOtIGBcaj2v5wZmElDndzSHGOS7roQsoTelPSok0"
        + "qqMucurMWE0FGexGpFuJkfPEm9tH2OjMOqegvEetpSVywH0W4Kh4"
    )

    ALGORITHM = "HS256"
    ACCESS_TOKEN_LENGTH: int = 90
    REFRESHER_TOKEN_LENGTH: int = 144
    PASSWORD_EXPIRE_DAY = datetime.timedelta(days=30)
    TOKEN_EXPIRE_MINUTES_1 = datetime.timedelta(minutes=1)
    TOKEN_EXPIRE_MINUTES_15 = datetime.timedelta(minutes=15)
    TOKEN_EXPIRE_MINUTES_30 = datetime.timedelta(minutes=30)
    TOKEN_EXPIRE_DAY_1 = datetime.timedelta(days=1)
    TOKEN_EXPIRE_DAY_5 = datetime.timedelta(days=5)
    TOKEN_EXPIRE_DAY_15 = datetime.timedelta(days=15)
    TOKEN_EXPIRE_DAY_30 = datetime.timedelta(days=30)


class WagDatabase:
    SQL: str = "postgresql+psycopg2"
    USERNAME: str = "berkay_wag_user"
    PASSWORD: str = "berkay_wag_user_password"
    HOST: str = "postgres_commercial"
    PORT = "5432"
    # HOST: str = "127.0.0.1"
    # PORT: str = "5434"
    DATABASE_NAME: str = "wag_database"
    DATABASE_URL = f"{SQL}://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE_NAME}"


class HagRedis:
    REDIS_HOST: str = "hardware_token_service"
    REDIS_PASSWORD: str = "hardware_redis_password"
    REDIS_PORT: int = 6379
    REDIS_DB: int = 0


class WagRedis:
    # REDIS_HOST: str = "10.10.2.44"
    # REDIS_PORT: int = 11112
    REDIS_HOST = "commercial_memory_service"
    REDIS_PASSWORD: str = "commercial_redis_password"
    REDIS_PORT: int = 6379
    REDIS_DB: int = 0


class TestRedis:
    REDIS_HOST: str = "localhost"
    REDIS_PASSWORD: str = "commercial_redis_password"
    REDIS_PORT: int = 11112
    REDIS_DB: int = 0


class TestDatabase:
    SQL: str = "postgresql+psycopg2"
    USERNAME: str = "berkay_wag_user"
    PASSWORD: str = "berkay_wag_user_password"
    HOST: str = "10.10.2.46"
    PORT: str = "5434"
    DATABASE_NAME: str = "wag_database"
    DATABASE_URL = f"{SQL}://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE_NAME}"


class MongoConfig:
    password = "mongo_password"
    username = "mongo_user"
    database_name = "mongo_database"
    # host = "10.10.2.44"
    # port = 11122
    host = "commercial_mongo_service"
    port = 27017
    url = f"mongodb://{username}:{password}@{host}:{port}/{database_name}?retryWrites=true&w=majority"


class TestMongo:
    password = "mongo_password"
    username = "mongo_user"
    database_name = "mongo_database"
    host = "localhost"
    port = 11110
    url = f"mongodb://{username}:{password}@{host}:{port}/{database_name}?retryWrites=true&w=majority"


class EmailConfig:
    EMAIL_HOST: str = "10.10.2.34"
    EMAIL_USERNAME: str = "karatay@mehmetkaratay.com.tr"
    EMAIL_PASSWORD: str = "system"


class RelationAccess:
    # 77 Evyos superuser of Superuser  - 78 all company superuser  - 98 Manager of 77 & 78
    SuperAccessList = ["77", "78", "98"]
