import AccessibilityAccordionItem from "@/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Accessibility"
import BreakfastAccordionItem from "@/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Breakfast"
import CheckInCheckOutAccordionItem from "@/components/SidePeeks/AmenitiesSidepeekContent/Accordions/CheckInCheckOut"
import ParkingAccordionItem from "@/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Parking"
import AdditionalAmenities from "@/components/SidePeeks/AmenitiesSidepeekContent/AdditionalAmenities"
import Accordion from "@/components/TempDesignSystem/Accordion"
import SidePeek from "@/components/TempDesignSystem/SidePeek"
import { getIntl } from "@/i18n"
import { appendSlugToPathname } from "@/utils/appendSlugToPathname"

import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { AmenitiesSidePeekProps } from "@/types/components/hotelPage/sidepeek/amenities"

export default async function AmenitiesSidePeek({
  amenitiesList,
  parking,
  checkInInformation,
  accessibility,
  restaurants,
  hotelType,
}: AmenitiesSidePeekProps) {
  const intl = await getIntl()

  const parkingPageHref = await appendSlugToPathname(parking.parkingPageUrl)
  const accessibilityPageHref = await appendSlugToPathname(
    accessibility.accessibilityPageUrl
  )

  return (
    <SidePeek
      contentKey={SidepeekSlugs.amenities}
      title={intl.formatMessage({
        defaultMessage: "Amenities",
      })}
    >
      <Accordion>
        <ParkingAccordionItem
          parking={parking.parking}
          elevatorPitch={parking.parkingElevatorPitch}
          parkingPageHref={parkingPageHref}
        />
        <BreakfastAccordionItem
          restaurants={restaurants}
          hotelType={hotelType}
        />
        <CheckInCheckOutAccordionItem checkInData={checkInInformation} />
        <AccessibilityAccordionItem
          accessibilityPageHref={accessibilityPageHref}
          elevatorPitch={accessibility.elevatorPitch}
        />
        <AdditionalAmenities amenities={amenitiesList} />
      </Accordion>
    </SidePeek>
  )
}
