"""Provides database model compliant with sqlalchemy."""
import datetime
import operator
import re

import six
import sqlalchemy as sa
from sqlalchemy.ext import declarative
from sqlalchemy import orm

from seedbox import constants

NONE_TYPE = 'none'
BOOL_TYPE = 'bool'
DATE_TYPE = 'datetime'
INT_TYPE = 'int'
STR_TYPE = 'str'
VAL_TYPES = [NONE_TYPE, BOOL_TYPE, DATE_TYPE, INT_TYPE, STR_TYPE]


def to_table_name(klass_name):
    """Generate table name based on class name.

    Convention is to take camel-case class name and rewrite it to an
    underscore form, e.g. 'ClassName' to 'class_name'

    :param klass_name: name of class
    :return: properly formatted table name