from __future__ import annotations

from sqlalchemy import CheckConstraint, Date, ForeignKey, Integer, Numeric, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.db.base import Base


class ContractDetail(Base):
    __tablename__ = "contract_detail"
    __table_args__ = {"schema": "v3"}

    line_id: Mapped[int] = mapped_column(Integer, ForeignKey("v3.budget_line.id"), primary_key=True)
    counterparty: Mapped[str | None] = mapped_column(String)
    reference: Mapped[str | None] = mapped_column(String)
    addenda: Mapped[str | None] = mapped_column(String)
    subject: Mapped[str | None] = mapped_column(String)
    currency: Mapped[str | None] = mapped_column(String)
    ceiling_amount: Mapped[float | None] = mapped_column(Numeric)
    expenses_q1: Mapped[float | None] = mapped_column(Numeric)
    expenses_q2: Mapped[float | None] = mapped_column(Numeric)
    expenses_q3: Mapped[float | None] = mapped_column(Numeric)
    expenses_q4: Mapped[float | None] = mapped_column(Numeric)
    rf_schedule: Mapped[str | None] = mapped_column(String)
    vat_rate: Mapped[str | None] = mapped_column(String)
    exchange_rate: Mapped[float | None] = mapped_column(Numeric)
    amount_foreign: Mapped[float | None] = mapped_column(Numeric)
    deadline: Mapped[str | None] = mapped_column(String)
    payment_scheme: Mapped[str | None] = mapped_column(String)
    act: Mapped[str | None] = mapped_column(String)
    comment: Mapped[str | None] = mapped_column(String)
    contract_date: Mapped[str | None] = mapped_column(Date)

#     line = relationship("BudgetLine", uselist=False)
