import { Suspense } from "react"

import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
import { MapContainer } from "@/components/MapContainer"

import styles from "./page.module.css"

import type { AlternativeHotelsSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
import type { LangParams, PageArgs } from "@/types/params"

export default async function SelectHotelMapPage({
  searchParams,
}: PageArgs<LangParams, AlternativeHotelsSearchParams>) {
  return (
    <div className={styles.main}>
      <MapContainer>
        <Suspense
          key={searchParams.hotel}
          fallback={<SelectHotelMapContainerSkeleton />}
        >
          <SelectHotelMapContainer
            searchParams={searchParams}
            isAlternativeHotels
          />
        </Suspense>
      </MapContainer>
    </div>
  )
}
