from __future__ import annotations

from datetime import date

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

from src.db.base import Base


class RentDetail(Base):
    __tablename__ = "rent_detail"
    __table_args__ = (
        Index("ix_v3_rent_detail_line", "line_id"),
        Index("ix_v3_rent_detail_vsp", "vsp_id"),
        {"schema": "v3"},
    )

    id: Mapped[int] = mapped_column(primary_key=True)
    line_id: Mapped[int] = mapped_column(Integer, ForeignKey("v3.budget_line.id"))
    vsp_id: Mapped[int] = mapped_column(Integer, ForeignKey("v3.vsp.id"))
    contract_number: Mapped[str | None] = mapped_column(String)
    contract_end_date: Mapped[date | None] = mapped_column(Date)
    plan_q1: Mapped[float | None] = mapped_column(Numeric)
    plan_q2: Mapped[float | None] = mapped_column(Numeric)
    plan_q3: Mapped[float | None] = mapped_column(Numeric)
    plan_q4: Mapped[float | None] = mapped_column(Numeric)
    actual_jan: Mapped[float | None] = mapped_column(Numeric)
    actual_feb: Mapped[float | None] = mapped_column(Numeric)
    actual_mar: Mapped[float | None] = mapped_column(Numeric)
    actual_apr: Mapped[float | None] = mapped_column(Numeric)
    actual_may: Mapped[float | None] = mapped_column(Numeric)
    actual_jun: Mapped[float | None] = mapped_column(Numeric)
    actual_jul: Mapped[float | None] = mapped_column(Numeric)
    actual_aug: Mapped[float | None] = mapped_column(Numeric)
    actual_sep: Mapped[float | None] = mapped_column(Numeric)
    actual_oct: Mapped[float | None] = mapped_column(Numeric)
    actual_nov: Mapped[float | None] = mapped_column(Numeric)
    actual_dec: Mapped[float | None] = mapped_column(Numeric)
    comment: Mapped[str | None] = mapped_column(String)

#     line = relationship("BudgetLine")
#     vsp = relationship("Vsp")
