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

from app.infrastructure.database.models import Base


class Accessory(Base):
    __tablename__ = 'accessories'

    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(VARCHAR(100), nullable=False)
    count = Column(Integer)
    volume = Column(Float)
    weight = Column(Float)
    period = Column(Integer)

    city_id = Column(ForeignKey('cities.id'))

    city = relationship('City', back_populates='accessories')

    delivery_accessories = relationship('DeliveryAccessory', back_populates='accessory')

