import { z } from "zod" import { nullableNumberValidator } from "@/utils/zod/numberValidator" import { addressSchema } from "./hotel/address" import { contactInformationSchema } from "./hotel/contactInformation" import { hotelContentSchema } from "./hotel/content" import { detailedFacilitiesSchema } from "./hotel/detailedFacility" import { hotelFactsSchema } from "./hotel/facts" import { gallerySchema } from "./hotel/gallery" import { healthFacilitySchema } from "./hotel/healthFacilities" import { includeSchema } from "./hotel/include/include" import { locationSchema } from "./hotel/location" import { merchantInformationSchema } from "./hotel/merchantInformation" import { parkingSchema } from "./hotel/parking" import { pointOfInterestsSchema } from "./hotel/poi" import { ratingsSchema } from "./hotel/rating" import { rewardNightSchema } from "./hotel/rewardNight" import { socialMediaSchema } from "./hotel/socialMedia" import { specialAlertsSchema } from "./hotel/specialAlerts" import { specialNeedGroupSchema } from "./hotel/specialNeedGroups" import { facilitySchema } from "./additionalData" import { imageSchema } from "./image" export const attributesSchema = z.object({ accessibilityElevatorPitchText: z.string().optional(), address: addressSchema, cityId: z.string(), cityName: z.string(), conferencesAndMeetings: facilitySchema.optional(), contactInformation: contactInformationSchema, detailedFacilities: detailedFacilitiesSchema, gallery: gallerySchema.optional(), galleryImages: z.array(imageSchema).optional(), healthAndWellness: facilitySchema.optional(), healthFacilities: z.array(healthFacilitySchema), hotelContent: hotelContentSchema, hotelFacts: hotelFactsSchema, hotelRoomElevatorPitchText: z.string().optional(), hotelType: z.string().optional(), isActive: z.boolean(), isPublished: z.boolean(), keywords: z.array(z.string()), location: locationSchema, merchantInformationData: merchantInformationSchema, name: z.string(), operaId: z.string(), parking: z.array(parkingSchema), pointsOfInterest: pointOfInterestsSchema, ratings: ratingsSchema, rewardNight: rewardNightSchema, restaurantImages: facilitySchema.optional(), socialMedia: socialMediaSchema, specialAlerts: specialAlertsSchema, specialNeedGroups: z.array(specialNeedGroupSchema), vat: nullableNumberValidator, }) export const includedSchema = z .array(includeSchema) .default([]) .transform((data) => data.filter((item) => { if (item) { if ("isPublished" in item && item.isPublished === false) { return false } return true } return false }) ) const relationshipSchema = z.object({ links: z.object({ related: z.string(), }), }) export const relationshipsSchema = z.object({ meetingRooms: relationshipSchema, nearbyHotels: relationshipSchema, restaurants: relationshipSchema, roomCategories: relationshipSchema, })