import { z } from "zod" import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" import type { CMSReward } from "../../../types/reward" 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 export type LoyaltyLevel = z.output[number] export type LevelWithRewards = LoyaltyLevel & { rewards: CMSReward[] }