from __future__ import annotations from datetime import datetime from pydantic import BaseModel class CreditSubscriptionPeriodOut(BaseModel): id: str sequence: int scheduled_at: datetime valid_from: datetime expires_at: datetime grant_credits: float allocated_paid_amount: float status: str issued_balance_id: str | None = None issued_at: datetime | None = None model_config = {"from_attributes": True} class CreditSubscriptionOut(BaseModel): id: str product_id: str | None = None payment_order_id: str status: str purchase_scene: str tier_code: str tier_rank: int billing_cycle: str anchor_at: datetime start_at: datetime expires_at: datetime next_grant_at: datetime | None = None monthly_grant_credits_snapshot: float grant_count: int granted_count: int paid_amount_snapshot: float source_subscription_id: str | None = None periods: list[CreditSubscriptionPeriodOut] = [] model_config = {"from_attributes": True}