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

from app.infrastructure.database.models import Base


class City(Base):
    __tablename__ = 'cities'

    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(VARCHAR(100), nullable=False)
    x_coordinate = Column(Float)
    y_coordinate = Column(Float)

    federal_district_id = Column(Integer, ForeignKey('federal_districts.id'))

    federal_district = relationship('FederalDistrict', back_populates='cities')

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