56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
"""Tariff schemas for VoIdea API."""
|
|
|
|
from datetime import datetime
|
|
from decimal import Decimal
|
|
from typing import Any, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TariffPlanCreate(BaseModel):
|
|
name: str = Field(min_length=1, max_length=100)
|
|
code: str = Field(min_length=1, max_length=50)
|
|
description: Optional[str] = None
|
|
price_monthly: Decimal = Decimal("0")
|
|
price_yearly: Optional[Decimal] = None
|
|
features: Optional[dict[str, Any]] = None
|
|
is_active: bool = True
|
|
sort_order: int = 0
|
|
|
|
|
|
class TariffPlanUpdate(BaseModel):
|
|
name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
description: Optional[str] = None
|
|
price_monthly: Optional[Decimal] = None
|
|
price_yearly: Optional[Decimal] = None
|
|
features: Optional[dict[str, Any]] = None
|
|
is_active: Optional[bool] = None
|
|
sort_order: Optional[int] = None
|
|
|
|
|
|
class TariffPlanResponse(BaseModel):
|
|
id: str
|
|
name: str
|
|
code: str
|
|
description: Optional[str] = None
|
|
price_monthly: Decimal
|
|
price_yearly: Optional[Decimal] = None
|
|
features: Optional[dict[str, Any]] = None
|
|
is_active: bool
|
|
sort_order: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class UserSubscriptionResponse(BaseModel):
|
|
id: str
|
|
user_id: str
|
|
plan_id: str
|
|
plan_name: str = ""
|
|
plan_code: str = ""
|
|
status: str
|
|
current_period_start: Optional[datetime] = None
|
|
current_period_end: Optional[datetime] = None
|
|
canceled_at: Optional[datetime] = None
|
|
created_at: datetime
|