from pydantic import BaseModel
from typing import Optional
from datetime import datetime

# 创建订单
class OrderCreate(BaseModel):
    work_id: int
    payment_method: str = "balance"  # balance, alipay, wechat

# 订单响应
class OrderResponse(BaseModel):
    id: int
    order_no: str
    user_id: int
    work_id: int
    amount: float
    payment_method: str
    status: str
    paid_at: Optional[datetime]
    created_at: datetime
    
    class Config:
        from_attributes = True

# 支付响应
class PaymentResponse(BaseModel):
    success: bool
    message: str
    order_no: str
    download_url: Optional[str] = None
