from pydantic import BaseModel
from datetime import datetime


class RechargeRequest(BaseModel):
    plan: str  # package id
    method: str = "wechat"  # "wechat" or "alipay"


class PaymentOrderOut(BaseModel):
    id: str
    order_no: str
    amount: float
    credits: float
    payment_method: str
    status: str
    qr_url: str | None = None  # Alipay QR code URL (transient, not persisted)
    created_at: datetime
    paid_at: datetime | None = None

    model_config = {"from_attributes": True}
