"""Model-type lookup (types the vendor MODELS catalog).

The Machine instance model and its PC/status lookups were retired (ADR-001);
assets are the platform contract. ModelType is kept because the shared `models`
table references it via models.modeltypeid: it types vendor models (Lathe,
Switch, Laser Printer), not asset instances. Renamed from MachineType to be
role-accurate and to free the "machinetype" name for the machines plugin.
"""

from shopdb.extensions import db
from .base import BaseModel


class ModelType(BaseModel):
    """
    Model-type classification (what kind of thing a catalog model is for).
    Categories: Equipment, PC, Network, Printer
    """
    __tablename__ = 'modeltypes'

    modeltypeid = db.Column(db.Integer, primary_key=True)
    modeltype = db.Column(db.String(100), unique=True, nullable=False)
    category = db.Column(
        db.String(50),
        nullable=False,
        default='Equipment',
        comment='Equipment, PC, Network, or Printer'
    )
    description = db.Column(db.Text)
    icon = db.Column(db.String(50), comment='Icon name for UI')

    def __repr__(self):
        return f"<ModelType {self.modeltype}>"
