from sqlalchemy import BigInteger, ForeignKey, Integer
from sqlalchemy.orm import Mapped, mapped_column

from app.models.base import BaseModel


class UserVerificationQuota(BaseModel):
    """Per-user real-name verification attempt quota."""

    __tablename__ = "user_verification_quotas"

    user_id: Mapped[int] = mapped_column(
        BigInteger,
        ForeignKey("users.id", ondelete="CASCADE"),
        unique=True,
        index=True,
        nullable=False,
    )
    free_used: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
    paid_remaining: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
    paid_purchased: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
    paid_used: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
