2026-05-18 11:12:10 +05:30
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
|
|
|
|
export const BillingPlanSchema = z.enum(['free', 'starter', 'pro']);
|
|
|
|
|
export type BillingPlan = z.infer<typeof BillingPlanSchema>;
|
|
|
|
|
|
2026-05-24 12:46:54 +05:30
|
|
|
export const BillingUsageBucketSchema = z.object({
|
|
|
|
|
sanctionedCredits: z.number(),
|
|
|
|
|
usedCredits: z.number(),
|
|
|
|
|
availableCredits: z.number(),
|
|
|
|
|
});
|
|
|
|
|
export type BillingUsageBucket = z.infer<typeof BillingUsageBucketSchema>;
|
|
|
|
|
|
2026-05-18 11:12:10 +05:30
|
|
|
export const BillingInfoSchema = z.object({
|
|
|
|
|
userEmail: z.string().nullable(),
|
|
|
|
|
userId: z.string().nullable(),
|
|
|
|
|
subscriptionPlan: BillingPlanSchema.nullable(),
|
|
|
|
|
subscriptionStatus: z.string().nullable(),
|
|
|
|
|
trialExpiresAt: z.string().nullable(),
|
2026-05-24 12:46:54 +05:30
|
|
|
monthly: BillingUsageBucketSchema,
|
|
|
|
|
daily: BillingUsageBucketSchema.extend({
|
|
|
|
|
usageDay: z.string(),
|
|
|
|
|
}),
|
2026-05-18 11:12:10 +05:30
|
|
|
});
|
|
|
|
|
export type BillingInfo = z.infer<typeof BillingInfoSchema>;
|