from __future__ import annotations

from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field


class CreditSummary(BaseModel):
    user_id: str = Field(..., alias="userId")
    credits: int
    total_credits_used: int = Field(..., alias="totalCreditsUsed")
    plan: str
    last_reset_date: Optional[datetime] = Field(None, alias="lastResetDate")
    next_reset_date: Optional[datetime] = Field(None, alias="nextResetDate")


class CreditLogItem(BaseModel):
    id: str
    amount: int
    type: str
    description: str
    timestamp: datetime
