# Path: APITaxi_models2/mixins.py
# class HistoryMixin:
#     added_at = db.Column(db.DateTime)
#     added_via = db.Column(db.Enum('form', 'api', name='sources'), nullable=False)
#     source = db.Column(db.String(255), nullable=False)
#     last_update_at = db.Column(db.DateTime)


from . import db
from .mixins import HistoryMixin
    'free',
    'occupied',
    'off'
]

# VEHICLE_STATUS = statuses operator can update + statuses workers
# automatically update.
VEHICLE_STATUS = UPDATABLE_VEHICLE_STATUS + [
    'answering',
    'oncoming',
]


class Vehicle(db.Model):

    __table_args__ = (
        db.UniqueConstraint('licence_plate', name='unique_vehicle'),
    )

    def __repr__(self):
        return '<Vehicle %s (%s)>' % (self.id, self.licence_plate)

    id = db.Column(db.Integer, primary_key=True)
    licence_plate = db.Column(db.String(80), nullable=False, unique=True)

    descriptions = db.relationship('VehicleDescription', lazy='raise', viewonly=True)


class VehicleDescription(HistoryMixin, db.Model):


# Path: APITaxi_models2/mixins.py
# class HistoryMixin:
#     added_at = db.Column(db.DateTime)
#     added_via = db.Column(db.Enum('form', 'api', name='sources'), nullable=False)
#     source = db.Column(db.String(255), nullable=False)
#     last_update_at = db.Column(db.DateTime)


# Path: APITaxi_models2/vehicle.py
from . import db
from .mixins import HistoryMixin

    'free',
    'occupied',
    'off'
]

# VEHICLE_STATUS = statuses operator can update + statuses workers
# automatically update.
VEHICLE_STATUS = UPDATABLE_VEHICLE_STATUS + [
    'answering',
    'oncoming',
]


class Vehicle(db.Model):

    __table_args__ = (
        db.UniqueConstraint('licence_plate', name='unique_vehicle'),
    )

    def __repr__(self):
        return '<Vehicle %s (%s)>' % (self.id, self.licence_plate)

    id = db.Column(db.Integer, primary_key=True)
    licence_plate = db.Column(db.String(80), nullable=False, unique=True)

    descriptions = db.relationship('VehicleDescription', lazy='raise', viewonly=True)


class VehicleDescription(HistoryMixin, db.Model):


    __table_args__ = (