import type { z } from "zod"

import type { MarkerInfo } from "@/types/components/maps/marker"
import type {
  destinationPagesHotelDataSchema,
  hotelSchema,
} from "@/server/routers/hotels/output"
import type { citySchema } from "@/server/routers/hotels/schemas/city"
import type { attributesSchema } from "@/server/routers/hotels/schemas/hotel"
import type { addressSchema } from "@/server/routers/hotels/schemas/hotel/address"
import type { hotelContentSchema } from "@/server/routers/hotels/schemas/hotel/content"
import type {
  detailedFacilitiesSchema,
  detailedFacilitySchema,
} from "@/server/routers/hotels/schemas/hotel/detailedFacility"
import type { checkinSchema } from "@/server/routers/hotels/schemas/hotel/facts"
import type { healthFacilitySchema } from "@/server/routers/hotels/schemas/hotel/healthFacilities"
import type {
  extraPageSchema,
  transformAdditionalData,
} from "@/server/routers/hotels/schemas/hotel/include/additionalData"
import type { facilitySchema } from "@/server/routers/hotels/schemas/hotel/include/additionalData/facility"
import type { nearbyHotelsSchema } from "@/server/routers/hotels/schemas/hotel/include/nearbyHotels"
import type {
  openingHoursDetailsSchema,
  openingHoursSchema,
  restaurantsSchema,
} from "@/server/routers/hotels/schemas/hotel/include/restaurants"
import type { transformRoomCategories } from "@/server/routers/hotels/schemas/hotel/include/roomCategories"
import type { locationSchema } from "@/server/routers/hotels/schemas/hotel/location"
import type { parkingSchema } from "@/server/routers/hotels/schemas/hotel/parking"
import type { pointOfInterestSchema } from "@/server/routers/hotels/schemas/hotel/poi"
import type { ratingsSchema } from "@/server/routers/hotels/schemas/hotel/rating"
import type { imageSchema } from "@/server/routers/hotels/schemas/image"

export type HotelData = z.output<typeof hotelSchema>

export type Amenities = z.output<typeof detailedFacilitiesSchema>
export type CheckInData = z.output<typeof checkinSchema>
type CitySchema = z.output<typeof citySchema>
export type City = Pick<CitySchema, "id" | "type"> & CitySchema["attributes"]
export type FacilityData = z.output<typeof facilitySchema>
export type Facility = FacilityData & { id: string }
export type ApiImage = z.output<typeof imageSchema>
export type DetailedFacility = z.output<typeof detailedFacilitySchema>
export type HealthFacility = z.output<typeof healthFacilitySchema>
export type HealthFacilities = HealthFacility[]
export type Hotel = z.output<typeof attributesSchema>
export type HotelAddress = z.output<typeof addressSchema>
export type HotelContent = z.output<typeof hotelContentSchema>
export type HotelLocation = z.output<typeof locationSchema>
export type HotelRatings = z.output<typeof ratingsSchema>
type NearbyHotelsSchema = z.output<typeof nearbyHotelsSchema>
export type NearbyHotel = Pick<NearbyHotelsSchema, "id" | "type"> &
  NearbyHotelsSchema["attributes"]
export type Parking = z.output<typeof parkingSchema>
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
type RestaurantSchema = z.output<typeof restaurantsSchema>
export type Restaurant = Pick<RestaurantSchema, "id" | "type"> &
  RestaurantSchema["attributes"]
export type RestaurantOpeningHours = z.output<typeof openingHoursSchema>
export type RestaurantOpeningHoursDay = z.output<
  typeof openingHoursDetailsSchema
>
export type Room = ReturnType<typeof transformRoomCategories>
export type RoomCategory = Room
export type RoomCategories = RoomCategory[]

export type PoiMapMarkersProps = {
  activePoi?: string | null
  coordinates: { lat: number; lng: number }
  onActivePoiChange?: (poiName: string | null) => void
  pointsOfInterest: PointOfInterest[]
  markerInfo: MarkerInfo
}
export type HotelTripAdvisor =
  | NonNullable<HotelRatings>["tripAdvisor"]
  | undefined

export type AdditionalData = ReturnType<typeof transformAdditionalData>

export type ExtraPageSchema = z.output<typeof extraPageSchema>

export type HotelDataWithUrl = HotelData & { url: string }

export type DestinationPagesHotelData = z.output<
  typeof destinationPagesHotelDataSchema
>
