Files
cfw-autumn/shared/models/billingModels/invoicingModels/lineItemContext.ts
John Yeo 07340cd79b wip
2025-12-16 13:05:57 +00:00

25 lines
770 B
TypeScript

import { z } from "zod/v4";
import { FeatureSchema } from "../../featureModels/featureModels";
import { PriceSchema } from "../../productModels/priceModels/priceModels";
import { ProductSchema } from "../../productModels/productModels";
export const BillingPeriodSchema = z.object({
start: z.number(),
end: z.number(),
});
export const LineItemContextSchema = z.object({
price: PriceSchema,
product: ProductSchema,
feature: FeatureSchema.optional(),
currency: z.string(),
billingPeriod: BillingPeriodSchema,
direction: z.enum(["charge", "refund"]),
now: z.number(),
billingTiming: z.enum(["in_arrear", "in_advance"]),
});
export type BillingPeriod = z.infer<typeof BillingPeriodSchema>;
export type LineItemContext = z.infer<typeof LineItemContextSchema>;