25 lines
747 B
TypeScript
25 lines
747 B
TypeScript
import { z } from "zod"
|
|
|
|
import { MembershipLevelEnum } from "@/constants/membershipLevels"
|
|
|
|
export const validateLoyaltyLevelsSchema = z
|
|
.object({
|
|
all_loyalty_level: z.object({
|
|
items: z.array(
|
|
z.object({
|
|
level_id: z.nativeEnum(MembershipLevelEnum),
|
|
name: z.string(),
|
|
user_facing_tag: z.string().optional(),
|
|
description: z.string().optional(),
|
|
required_nights: z.number().optional().nullable(),
|
|
required_points: z.number(),
|
|
})
|
|
),
|
|
}),
|
|
})
|
|
.transform((data) => data.all_loyalty_level.items)
|
|
|
|
export type LoyaltyLevelsResponse = z.input<typeof validateLoyaltyLevelsSchema>
|
|
|
|
export type LoyaltyLevel = z.output<typeof validateLoyaltyLevelsSchema>[0]
|