Co-authored-by: Michael Chihlas <michael@resolutionflow.com> Co-committed-by: Michael Chihlas <michael@resolutionflow.com>
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
from typing import Optional
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class SubscriptionResponse(BaseModel):
|
|
id: UUID
|
|
plan: str
|
|
status: str
|
|
billing_interval: Optional[str] = None
|
|
current_period_start: Optional[datetime] = None
|
|
current_period_end: Optional[datetime] = None
|
|
cancel_at_period_end: bool = False
|
|
stripe_subscription_id: Optional[str] = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class PlanLimitsResponse(BaseModel):
|
|
plan: str
|
|
max_trees: Optional[int] = None
|
|
max_sessions_per_month: Optional[int] = None
|
|
max_users: Optional[int] = None
|
|
custom_branding: bool = False
|
|
priority_support: bool = False
|
|
export_formats: list[str] = ["markdown", "text"]
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class UsageResponse(BaseModel):
|
|
tree_count: int
|
|
session_count_this_month: int
|
|
|
|
|
|
class SubscriptionDetails(BaseModel):
|
|
subscription: SubscriptionResponse
|
|
limits: PlanLimitsResponse
|
|
usage: UsageResponse
|
|
|
|
|
|
class SubscriptionPlanUpdate(BaseModel):
|
|
plan: str # free, pro, starter, enterprise
|
|
|
|
model_config = {"json_schema_extra": {"examples": [{"plan": "pro"}]}}
|
|
|
|
|
|
class ExtendTrialRequest(BaseModel):
|
|
days: int # 1-90
|
|
|
|
model_config = {"json_schema_extra": {"examples": [{"days": 14}]}}
|