import { z } from "zod"

import {
  imageMetaDataSchema,
  imageSizesSchema,
} from "@/server/routers/hotels/schemas/image"

import { HotelData } from "./hotelCardListingProps"
import { Filter } from "./hotelFilters"

import type { Coordinates } from "@/types/components/maps/coordinates"

export interface HotelListingProps {
  hotels: HotelData[]
  activeHotelPin?: string | null
  setActiveHotelPin: (hotelName: string | null) => void
}

export interface SelectHotelMapProps {
  apiKey: string
  hotelPins: HotelPin[]
  mapId: string
  hotels: HotelData[]
}

type ImageSizes = z.infer<typeof imageSizesSchema>
type ImageMetaData = z.infer<typeof imageMetaDataSchema>

export type HotelPin = {
  name: string
  coordinates: Coordinates
  publicPrice: string | null
  memberPrice: string | null
  currency: string | null
  images: {
    imageSizes: ImageSizes
    metaData: ImageMetaData
  }[]
  amenities: Filter[]
  ratings: number | null
  operaId: string
}

export interface HotelListingMapContentProps {
  activeHotelPin?: HotelPin["name"] | null
  hotelPins: HotelPin[]
  onActiveHotelPinChange?: (pinName: string | null) => void
}

export interface HotelCardDialogProps {
  isOpen: boolean
  data: HotelPin
  handleClose: (event: { stopPropagation: () => void }) => void
}

export interface HotelCardDialogListingProps {
  hotels: HotelData[]
  activeCard: string | null | undefined
  onActiveCardChange: (hotelName: string | null) => void
}
