from sqlalchemy import Column, Integer, ForeignKey
from sqlalchemy.orm import relationship

from app.infrastructure.database.models import Base


class DeliveryAccessory(Base):
    __tablename__ = 'delivery_accessories'

    id = Column(Integer, primary_key=True, autoincrement=True)
    queue = Column(Integer, nullable=False)

    accessory_id = Column(Integer, ForeignKey('accessories.id'))
    delivery_order_id = Column(Integer, ForeignKey('delivery_orders.id'))

    accessory = relationship('Accessory', back_populates='delivery_accessories')
    delivery_order = relationship('DeliveryOrder', back_populates='delivery_accessories')
