"""
Variables defining options for:
- statement types
- table descriptor dictionary attribute selectable values
- other stuff
"""


# conf options

FILE_WRITE_MODE_APPEND = 'a+'
FILE_WRITE_MODE_OVERWITE = 'w'

# generator options

STATEMENT_TYPE_CREATE_TABLE     = 'CREATE_TABLE'
STATEMENT_TYPE_INSERT_INTO      = 'INSERT_INTO'
STATEMENT_TYPE_MERGE            = 'MERGE'
STATEMENT_TYPE_DELETE_FROM      = 'DELETE_FROM'
STATEMENT_TYPE_RENAME_COLUMN    = 'RENAME_COLUMN'

OPTIONS_STATEMENT_TYPE = [
    STATEMENT_TYPE_CREATE_TABLE,
    STATEMENT_TYPE_INSERT_INTO,
    STATEMENT_TYPE_MERGE,
    STATEMENT_TYPE_DELETE_FROM,
    STATEMENT_TYPE_RENAME_COLUMN,
]

OPTIONS_STATEMENT_TYPE_LOWER = [
    STATEMENT_TYPE_CREATE_TABLE.lower(),
    STATEMENT_TYPE_INSERT_INTO.lower(),
    STATEMENT_TYPE_MERGE.lower(),
    STATEMENT_TYPE_DELETE_FROM.lower(),
    STATEMENT_TYPE_RENAME_COLUMN.lower(),
]

STATEMENT_TYPE_ALT_NAMES = {
    STATEMENT_TYPE_CREATE_TABLE:    "CREATE_TABLE",
    STATEMENT_TYPE_INSERT_INTO:     "INSERT_VALUES",
    STATEMENT_TYPE_MERGE:           "INSERT_UPDATE_VALUES",
    STATEMENT_TYPE_DELETE_FROM:     "DELETE_FROM",
    STATEMENT_TYPE_RENAME_COLUMN:   "RENAME_COLUMN",
}

COL_MERGE_TYPE_REPLACE          = 'REPLACE'
COL_MERGE_TYPE_ACCUMLATE        = 'ACCUMULATE'
COL_MERGE_TYPE_SKIP             = 'SKIP'

OPTIONS_COL_MERGE_TYPE = [
    COL_MERGE_TYPE_REPLACE,
    COL_MERGE_TYPE_ACCUMLATE,
    COL_MERGE_TYPE_SKIP,
]
DEFAULT_COL_MERGE_TYPE = COL_MERGE_TYPE_REPLACE

COL_RELATION_UPDEL_NO_ACTION    = 'NO ACTION'
COL_RELATION_UPDEL_CASCADE      = 'CASCADE'
COL_RELATION_UPDEL_SET_NULL     = 'SET NULL'
COL_RELATION_UPDEL_SET_DEFAULT  = 'SET DEFAULT'

OPTIONS_COL_RELATION_UPDEL = [
    COL_RELATION_UPDEL_NO_ACTION,
    COL_RELATION_UPDEL_CASCADE,
    COL_RELATION_UPDEL_SET_NULL,
    COL_RELATION_UPDEL_SET_DEFAULT,
]

CONSTRAINT_PRIMARY_KEY = 'PRIMARY KEY'
