import sys

from decouple import config

try:
    from dotenv import load_dotenv

    load_dotenv()
except ImportError:
    pass


class Var(object):
    # mandatory
    API_ID = (
        int(sys.argv[1]) if len(sys.argv) > 1 else config("API_ID", default=6, cast=int)
    )
    API_HASH = (
        sys.argv[2]
        if len(sys.argv) > 2
        else config("API_HASH", default="eb06d4abfb49dc3eeb1aeb98ae0f581e")
    )
    SESSION_1 = config("SESSION_1", default=None)
    SESSION_2 = config("SESSION_2", default=None)
    SESSION_3 = config("SESSION_3", default=None)
    SESSION_4 = config("SESSION_4", default=None)
    SESSION_5 = config("SESSION_5", default=None)
    REDIS_URI = (
        config("REDIS_URI", default=None) or config("REDIS_URL", default=None)
    )
    REDIS_PASSWORD = config("REDIS_PASSWORD", default=None)
    # extras
    BOT_TOKEN = config("BOT_TOKEN", default=None)
    LOG_CHAT = config("LOG_CHAT", default=0, cast=int)
    HEROKU_APP_NAME = config("HEROKU_APP_NAME", default=None)
    HEROKU_API = config("HEROKU_API", default=None)
    TEMP_DOWNLOAD_DIRECTORY = config("TEMP_DOWNLOAD_DIRECTORY", default="./downloads")
    # for railway
    REDISPASSWORD = config("REDISPASSWORD", default=None)
    REDISHOST = config("REDISHOST", default=None)
    REDISPORT = config("REDISPORT", default=None)
    REDISUSER = config("REDISUSER", default=None)
    # for sql
    DATABASE_URL = config("DATABASE_URL", default=None)
    # for MONGODB users
    MONGO_URI = config("MONGO_URI", default=None)
    # for Okteto Platform
    OKTETO = config("OKTETO", cast=bool, default=False)
