import type { HotelData } from "@/types/hotel"

export function verifySubpageShouldExist(
  hotelData: HotelData,
  subpage: string
): boolean {
  const isRestaurant = hotelData.restaurants.find(
    (restaurant) => restaurant.nameInUrl === subpage
  )
  if (isRestaurant) {
    return true
  }

  const additionalData = hotelData.additionalData
  switch (subpage) {
    case additionalData.hotelParking.nameInUrl:
      if (additionalData.displayWebPage.parking) {
        return true
      }
    case additionalData.healthAndFitness.nameInUrl:
      if (additionalData.displayWebPage.healthGym) {
        return true
      }
    case additionalData.hotelSpecialNeeds.nameInUrl:
      if (additionalData.displayWebPage.specialNeeds) {
        return true
      }
    case additionalData.meetingRooms.nameInUrl:
      if (additionalData.displayWebPage.meetingRoom) {
        return true
      }
    case "reviews":
      if (
        hotelData.hotel.ratings?.tripAdvisor.reviews.widgetScriptEmbedUrlIframe
      ) {
        return true
      }
    default:
      return false
  }
}
