from sqlalchemy import Boolean, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from app.core.database import Base


class Venue(Base):
    __tablename__ = "venues"

    id: Mapped[int] = mapped_column(primary_key=True, index=True)
    name: Mapped[str] = mapped_column(String(120), nullable=False, index=True)
    portal_tenant_id: Mapped[str | None] = mapped_column(String(80), nullable=True, unique=True, index=True)
    portal_tenant_slug: Mapped[str | None] = mapped_column(String(120), nullable=True, index=True)
    layout_policy_applied: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)

    rooms = relationship("Room", back_populates="venue", cascade="all, delete-orphan")
    reservations = relationship("Reservation", back_populates="venue")
