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

from app.domain.models.base import BaseModel
from app.settings import settings


class AppointmentFile(BaseModel):
    __tablename__ = 'appointment_files'
    __table_args__ = {"schema": settings.SCHEMA}

    file_path = Column(String, nullable=False)
    file_title = Column(String, nullable=False)

    appointment_id = Column(Integer, ForeignKey(f'{settings.SCHEMA}.appointments.id'), nullable=False)

    appointment = relationship('Appointment', back_populates='files')