"""Legacy machine type lookup.

The Machine instance model and its PC/status lookups were retired (ADR-001);
assets are the platform contract. MachineType is kept only because the shared
`models` table still references it via models.machinetypeid.
"""

from shopdb.extensions import db
from .base import BaseModel


class MachineType(BaseModel):
    """
    Machine type classification.
    Categories: Equipment, PC, Network, Printer
    """
    __tablename__ = 'machinetypes'

    machinetypeid = db.Column(db.Integer, primary_key=True)
    machinetype = 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"<MachineType {self.machinetype}>"
