62 lines
1.5 KiB
TypeScript
Raw Normal View History

/**
* Subscriptions Domain - Contract
*
* Defines the normalized subscription types used throughout the application.
* Provider-agnostic interface that all subscription providers must map to.
*/
// Subscription Status
export const SUBSCRIPTION_STATUS = {
ACTIVE: "Active",
INACTIVE: "Inactive",
PENDING: "Pending",
CANCELLED: "Cancelled",
SUSPENDED: "Suspended",
TERMINATED: "Terminated",
COMPLETED: "Completed",
} as const;
export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUS)[keyof typeof SUBSCRIPTION_STATUS];
// Subscription Billing Cycle
export const SUBSCRIPTION_CYCLE = {
MONTHLY: "Monthly",
QUARTERLY: "Quarterly",
SEMI_ANNUALLY: "Semi-Annually",
ANNUALLY: "Annually",
BIENNIALLY: "Biennially",
TRIENNIALLY: "Triennially",
ONE_TIME: "One-time",
FREE: "Free",
} as const;
export type SubscriptionCycle = (typeof SUBSCRIPTION_CYCLE)[keyof typeof SUBSCRIPTION_CYCLE];
// Subscription
export interface Subscription {
id: number;
serviceId: number;
productName: string;
domain?: string;
cycle: SubscriptionCycle;
status: SubscriptionStatus;
nextDue?: string;
amount: number;
currency: string;
currencySymbol?: string;
registrationDate: string;
notes?: string;
customFields?: Record<string, string>;
orderNumber?: string;
groupName?: string;
paymentMethod?: string;
serverName?: string;
}
// Subscription List
export interface SubscriptionList {
subscriptions: Subscription[];
totalCount: number;
}