"""
Linux BenchTools - Manufacturer Link Model
"""

from sqlalchemy import Column, Integer, String, Text, ForeignKey
from sqlalchemy.orm import relationship
from app.db.base import Base


class ManufacturerLink(Base):
    """
    Links to manufacturer resources
    """
    __tablename__ = "manufacturer_links"

    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    device_id = Column(Integer, ForeignKey("devices.id"), nullable=False, index=True)
    label = Column(String(255), nullable=False)
    url = Column(Text, nullable=False)

    # Relationships
    device = relationship("Device", back_populates="manufacturer_links")

    def __repr__(self):
        return f"<ManufacturerLink(id={self.id}, device_id={self.device_id}, label='{self.label}')>"
