from __future__ import annotations

from sqlalchemy import ForeignKey, Index, Integer, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.db.base import Base


class FormLimit(Base):
    __tablename__ = "form_limit"
    __table_args__ = (
        Index("ix_v3_form_limit_form", "budget_form_id"),
        {"schema": "v3"},
    )

    budget_form_id: Mapped[int] = mapped_column(Integer, ForeignKey("v3.budget_form.id", ondelete="CASCADE"), primary_key=True)
    template_id: Mapped[int] = mapped_column(Integer, ForeignKey("v3.limit_template.id", ondelete="CASCADE"), primary_key=True)
    qty_q1: Mapped[int | None] = mapped_column(Integer)
    qty_q2: Mapped[int | None] = mapped_column(Integer)
    qty_q3: Mapped[int | None] = mapped_column(Integer)
    qty_q4: Mapped[int | None] = mapped_column(Integer)
    comment: Mapped[str | None] = mapped_column(String)

#     budget_form = relationship("BudgetForm")
#     template = relationship("LimitTemplate")
