import { z } from "zod"

import { nullableStringValidator } from "@/utils/zod/stringValidator"

export const checkinSchema = z.object({
  checkInTime: nullableStringValidator,
  checkOutTime: nullableStringValidator,
  onlineCheckout: z.boolean(),
  onlineCheckOutAvailableFrom: nullableStringValidator,
})

const ecoLabelsSchema = z.object({
  euEcoLabel: z.boolean(),
  greenGlobeLabel: z.boolean(),
  nordicEcoLabel: z.boolean(),
  svanenEcoLabelCertificateNumber: nullableStringValidator,
})

const interiorSchema = z.object({
  numberOfBeds: z.number(),
  numberOfCribs: z.number(),
  numberOfFloors: z.number(),
  numberOfRooms: z.object({
    connected: z.number(),
    forAllergics: z.number(),
    forDisabled: z.number(),
    nonSmoking: z.number(),
    pet: z.number(),
    withExtraBeds: z.number(),
    total: z.number(),
  }),
})

const receptionHoursSchema = z.object({
  alwaysOpen: z.boolean(),
  closingTime: nullableStringValidator,
  isClosed: z.boolean(),
  openingTime: nullableStringValidator,
})

export const hotelFactsSchema = z.object({
  checkin: checkinSchema,
  ecoLabels: ecoLabelsSchema,
  interior: interiorSchema,
  receptionHours: receptionHoursSchema,
  yearBuilt: nullableStringValidator,
})
