import { subscriptionPlanFromJson, type SubscriptionPlan, } from './SubscriptionPlan'; import type { SubscriptionStatus } from './SubscriptionStatus'; /** * Details about a customer’s subscription.. */ export interface SubscriptionInfo { /** * The **plan definition** that the customer chose. */ plan?: SubscriptionPlan; /** * The state of the plan. */ status?: SubscriptionStatus; /** Unique identifier of this specific the selected plan. */ id?: string; } export function subscriptionInfoFromJson(jsonMap: { [key: string]: any; }): SubscriptionInfo { return { plan: jsonMap.plan ? subscriptionPlanFromJson(jsonMap.plan as { [k: string]: any }) : undefined, // If the backend sends an unknown value, this will be `undefined` // and TypeScript will surface that at compile-time. status: jsonMap.status as SubscriptionStatus | undefined, id: jsonMap.id, }; }