import os


class BaseConfig:
    """Base configuration"""

    DEBUG = False
    TESTING = False
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    BCRYPT_LOG_ROUNDS = 13
    TOKEN_EXPIRATION_DAYS = 30
    TOKEN_EXPIRATION_SECONDS = 0
    REGISTRATION_ALLOWED = (
        False if os.getenv("RDLTR_ALLOW_REGISTRATION") == "false" else True
    )


class DevelopmentConfig(BaseConfig):
    """Development configuration"""

    DEBUG = True
    SQLALCHEMY_DATABASE_URI = os.getenv("RDLTR_DB_URL", "sqlite:///rdltr.db")
    SECRET_KEY = "development key"  # nosec
    USERNAME = "admin"
    PASSWORD = "default"  # nosec
    BCRYPT_LOG_ROUNDS = 4


class TestingConfig(BaseConfig):
    """Testing configuration"""

    DEBUG = True
    TESTING = True
    SQLALCHEMY_DATABASE_URI = os.getenv(
        "RDLTR_DB_TEST_URL", "sqlite:///rdltr_test.db"
    )
    SECRET_KEY = "test key"  # nosec
    USERNAME = "admin"
    PASSWORD = "default"  # nosec
    BCRYPT_LOG_ROUNDS = 4
    TOKEN_EXPIRATION_DAYS = 0
    TOKEN_EXPIRATION_SECONDS = 3


class ProductionConfig(BaseConfig):
    """Production configuration"""

    DEBUG = False
    SQLALCHEMY_DATABASE_URI = os.getenv("RDLTR_DB_URL")
    SECRET_KEY = os.getenv("RDLTR_SECRET_KEY")
