27 lines
810 B
TypeScript
27 lines
810 B
TypeScript
import { z } from "zod";
|
|
|
|
import { stringOrNull } from "../nullable-defaults";
|
|
|
|
export const GiftProductSchema = z
|
|
.object({
|
|
planId: z.string().min(1),
|
|
planName: z.string(),
|
|
orderType: z.literal("tip"),
|
|
tipType: z.string(),
|
|
category: z.string().min(1),
|
|
characterId: z.string().min(1),
|
|
description: z.string(),
|
|
imageUrl: z.string().nullable(),
|
|
amountCents: z.number().int().nonnegative(),
|
|
currency: z.string(),
|
|
autoRenew: z.literal(false),
|
|
isFirstRechargeOffer: z.literal(false),
|
|
firstRechargeDiscountPercent: z.number().int(),
|
|
promotionType: stringOrNull,
|
|
})
|
|
.readonly();
|
|
|
|
export type GiftProductInput = z.input<typeof GiftProductSchema>;
|
|
export type GiftProductData = z.output<typeof GiftProductSchema>;
|
|
export type GiftProduct = GiftProductData;
|