from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
from core.database import Base
from sqlalchemy import DECIMAL, Column, Integer, BigInteger, String


class Vehicle(Base, TenantScopedMixin, TimestampMixin):
    __tablename__ = "vehicle"
    __table_args__ = (
        {"schema": "a76"},
    )

    vehicle_key = Column(String(14), primary_key=True, nullable=False)
    # Internal integer identifier (surrogate). The frontend continues to use vehicle_key.
    vehicle_id = Column(BigInteger, nullable=False, unique=True, index=True)
    ace_vehicle_key = Column(String(10), nullable=True)
    transporter_key = Column(String(23), nullable=True)
    transport_identifier = Column(String(30), nullable=True)
    transport_type = Column(String(2), nullable=True)
    entity_code = Column(String(1), nullable=True)
    transponder_number = Column(String(16), nullable=True)
    dot_number = Column(String(8), nullable=True)
    plate_number = Column(String(17), nullable=True)
    city = Column(String(30), nullable=True)
    state = Column(String(30), nullable=True)
    country = Column(String(3), nullable=True)
    seal = Column(String(49), nullable=True)
    insurance_company_name = Column(String(30), nullable=True)
    insurance_number = Column(String(20), nullable=True)
    insurance_amount = Column(DECIMAL(13, 2), nullable=True)
    insurance_date = Column(Integer, nullable=True)
    box_number = Column(String(300), nullable=True)
    brand = Column(String(20), nullable=True)
    year = Column(String(4), nullable=True)
    series = Column(String(30), nullable=True)
    description = Column(String(100), nullable=True)
    engine_number = Column(String(50), nullable=True)
    sct_permission = Column(String(40), nullable=True)
    color = Column(String(20), nullable=True)
    container_key = Column(String(3), nullable=True)
