44 lines
872 B
Python
44 lines
872 B
Python
from pydantic import BaseModel
|
|
from typing import List, Optional
|
|
from datetime import date, datetime
|
|
from uuid import UUID
|
|
|
|
|
|
class PlanFeature(BaseModel):
|
|
name: str
|
|
included: bool
|
|
|
|
|
|
class PlanDetail(BaseModel):
|
|
id: str
|
|
name: str
|
|
price: float
|
|
max_queries: int
|
|
max_brands: int # -1 表示无限
|
|
max_alerts_per_month: int # -1 表示无限, 0 表示无
|
|
data_retention_days: int
|
|
features: List[PlanFeature]
|
|
|
|
|
|
class SubscribeRequest(BaseModel):
|
|
plan: str
|
|
|
|
|
|
class SubscriptionResponse(BaseModel):
|
|
id: UUID
|
|
plan: str
|
|
status: str
|
|
start_date: date
|
|
end_date: date
|
|
amount: Optional[float] = None
|
|
payment_method: Optional[str] = None
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class SubscriptionHistoryResponse(BaseModel):
|
|
items: List[SubscriptionResponse]
|
|
total: int
|