class __cls_aide_dao_db_types__:
    class _cls_db_type:
        def __init__(self, type_name: str, list_alias=None):

            if list_alias is None:
                list_alias = [type_name]
            elif isinstance(list_alias, list):
                list_alias.append(type_name)
            else:
                list_alias = list_alias.splite(",")

            self.__dict = {"type_name": type_name,
                           "aliases": list_alias,
                           "sql": None}

        def __str__(self):
            return self

        @property
        def dict(self):
            return self.__dict

        @property
        def type_name(self):
            return self.__dict["type_name"]

        @property
        def aliases(self):
            return self.__dict["aliases"]

        @property
        def sql(self):
            return self.__dict["sql"]

        def set_sql(self, new_sql):
            self.__dict["sql"] = new_sql

    DB2 = _cls_db_type(type_name="DB2")

    Pgs = _cls_db_type(type_name="PostgreSQL", list_alias=['pgs', 'postgres'])

    SQLite = _cls_db_type(type_name="SQLite")

    @classmethod
    def get_db_type(cls, db_alias: str):
        if db_alias is None:
            return cls.Pgs
        else:
            for attr in dir(cls):
                inst = getattr(cls, attr)
                if isinstance(inst, cls._cls_db_type):
                    if db_alias.upper() in [alias.upper() for alias in inst.aliases]:
                        return inst

    dict_TYPE_int = {DB2: "INTEGER",
                     Pgs: "INTEGER",
                     SQLite: "INTEGER"}

    dict_TYPE_bigint = {DB2: "BIGINT",
                        Pgs: "bigint",
                        SQLite: "bigint"}

    dict_TYPE_timestamp = {DB2: "TIMESTAMP",
                           Pgs: "timestamptz(6)",
                           SQLite: ""}

    dict_TYPE_varchar = {DB2: "varchar(254)",
                         Pgs: "varchar(254)",
                         SQLite: "nvarchar(254)"}

    dict_TYPE_char = {DB2: "char(254)",
                      Pgs: "char(254)",
                      SQLite: "nvarchar(254)"}

    # col type collection
    dict_col_type = {"int": dict_TYPE_int,
                     "varchar": dict_TYPE_varchar,
                     "char": dict_TYPE_char,
                     "bigint": dict_TYPE_bigint,
                     "timestamp": dict_TYPE_timestamp}

    # primary and auto increase
    dict_TYPE_primary_key = {DB2: "AS IDENTITY PRIMARY KEY",
                             Pgs: "PRIMARY KEY",
                             SQLite: "PRIMARY KEY"}

    dict_TYPE_auto_increase = {DB2: "GENERATED BY DEFAULT",
                               Pgs: "GENERATED BY DEFAULT",
                               SQLite: "AUTOINCREMENT"}

    dict_TYPE_primary_and_auto = {DB2: dict_TYPE_auto_increase[DB2] + " " + dict_TYPE_primary_key[DB2],
                                  Pgs: dict_TYPE_primary_key[Pgs] + " " + dict_TYPE_auto_increase[Pgs],
                                  SQLite: dict_TYPE_primary_key[SQLite] + " " + dict_TYPE_auto_increase[SQLite]}

    # time
    dict_SQL_timestamp = {DB2: "CURRENT_TIMESTAMP",
                          Pgs: "CURRENT_TIMESTAMP",
                          SQLite: "AUTOINCREMENT"}

    # SQL_DB2 = "TIMESTAMP (CURRENT TIMESTAMP - (CURRENT TIMEZONE * 0.36)SECONDS)"
    dict_SQL_timestamp_gmt0 = {DB2: "CURRENT_TIMESTAMP-CURRENT_TIMEZONE",
                               Pgs: "CURRENT_TIMESTAMP",
                               SQLite: "AUTOINCREMENT"}
