"""Printer driver: a named link (SMB path or HTTP URL) to driver files.""" from shopdb.api import db class PrinterDriver(db.Model): __tablename__ = 'printerdrivers' driverid = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(150), nullable=False) # SMB path (\\\\server\\share\\...) or HTTP URL to the driver package location = db.Column(db.String(500), nullable=False) description = db.Column(db.Text) # Optional: attach a driver to a specific printer model modelnumberid = db.Column( db.Integer, db.ForeignKey('models.modelnumberid'), nullable=True ) isactive = db.Column(db.Boolean, default=True, nullable=False) model = db.relationship('Model') def to_dict(self): return { 'driverid': self.driverid, 'name': self.name, 'location': self.location, 'description': self.description, 'modelnumberid': self.modelnumberid, 'modelname': self.model.modelnumber if self.model else None, 'isactive': bool(self.isactive), }