# Path: reggata/helpers.py
# def is_none_or_empty(s):
#     '''
#         Returns True, if given string s is None or "" (empty string).
#     If s is and instance of class different from str, function raises TypeError.
#     '''
#     if s is None:
#         return True
#     else:
#         if not isinstance(s, str):
#             raise TypeError("is_none_or_empty() can be applied only to str objects.")
#         return True if s == "" else False


import sqlalchemy as sqa
import datetime
import os
import hashlib
import reggata.memento as memento
import reggata.helpers as helpers
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import ForeignKey, orm
from reggata.helpers import is_none_or_empty



class JsonUnsupportedVersionError(Exception):
    def __init__(self, msg=None, cause=None):
        super(JsonUnsupportedVersionError, self).__init__(msg)
        self.cause = cause



Base = declarative_base()

class User(Base):
    __tablename__ = "users"

    USER = 'USER'
    ADMIN = 'ADMIN'

    login = sqa.Column(sqa.String, primary_key=True)
    password = sqa.Column(sqa.String)
    group = sqa.Column(sqa.Enum(USER, ADMIN), nullable=False, default=USER)
    date_created = sqa.Column(sqa.DateTime)

    def __init__(self, login=None, password=None, group=USER):
        self.login = login
        self.password = password
        self.group = group
        self.date_created = datetime.datetime.today()

    def checkValid(self):

# Path: reggata/helpers.py
# def is_none_or_empty(s):
#     '''
#         Returns True, if given string s is None or "" (empty string).
#     If s is and instance of class different from str, function raises TypeError.
#     '''
#     if s is None:
#         return True
#     else:
#         if not isinstance(s, str):
#             raise TypeError("is_none_or_empty() can be applied only to str objects.")
#         return True if s == "" else False


# Path: reggata/data/db_schema.py
import sqlalchemy as sqa
import datetime
import os
import hashlib
import reggata.memento as memento
import reggata.helpers as helpers
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import ForeignKey, orm
from reggata.helpers import is_none_or_empty




class JsonUnsupportedVersionError(Exception):
    def __init__(self, msg=None, cause=None):
        super(JsonUnsupportedVersionError, self).__init__(msg)
        self.cause = cause



Base = declarative_base()

class User(Base):
    __tablename__ = "users"

    USER = 'USER'
    ADMIN = 'ADMIN'

    login = sqa.Column(sqa.String, primary_key=True)
    password = sqa.Column(sqa.String)
    group = sqa.Column(sqa.Enum(USER, ADMIN), nullable=False, default=USER)
    date_created = sqa.Column(sqa.DateTime)

    def __init__(self, login=None, password=None, group=USER):
        self.login = login
        self.password = password
        self.group = group
        self.date_created = datetime.datetime.today()

    def checkValid(self):

        if helpers.is_none_or_empty(self.login):