"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""


class Settings(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    keyname = db.Column(db.String(128))
    valuename = db.Column(db.String(128))

    def __init__(self, keyname, valuename):
        self.keyname = keyname
        self.valuename = valuename

    def __repr__(self):
        return "<key '{}': value '{}'>".format(self.keyname, self.valuename)


class Targets(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    targetname = db.Column(db.String(128))
    username = db.Column(db.String(128))
    password = db.Column(db.String(128))
    account = db.Column(db.String(128))
    warehouse = db.Column(db.String(128))
    database = db.Column(db.String(128))
    schemaname = db.Column(db.String(128))

    def __init__(
        self, targetname, username, password, account, warehouse, database, schemaname
    ):
        self.targetname = targetname
        self.username = username
        self.password = password
        self.account = account
        self.warehouse = warehouse
        self.database = database
        self.schemaname = schemaname

    def __repr__(self):
        return "<target: '{}, {}, {}, {}, {}, {}, {}'>".format(
            self.targetname,
            self.username,
            self.password,
            self.account,
            self.warehouse,
            self.database,
            self.schemaname,
        )


class Queries(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    keyname = db.Column(db.String(128))
    valuename = db.Column(db.String(128))

    def __init__(self, keyname, valuename):
        self.keyname = keyname
        self.valuename = valuename

    def __repr__(self):
        return "<key '{}': value '{}'>".format(self.keyname, self.valuename)


class Sync_params(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    keyname = db.Column(db.String(128))
    valuename = db.Column(db.String(128))

    def __init__(self, keyname, valuename):
        self.keyname = keyname
        self.valuename = valuename

    def __repr__(self):
        return "<key '{}': value '{}'>".format(self.keyname, self.valuename)


class Excluded_columns(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    columnname = db.Column(db.String(128))

    def __init__(self, columnname):
        self.columnname = columnname

    def __repr__(self):
        return "<columnname '{}'>".format(self.columnname)
