import { getHotelsByCSFilter } from "@/lib/trpc/memoizedRequests"

import CampaignHotelListingClient from "./Client"

interface CampaignHotelListingProps {
  heading: string
  hotelIds: string[]
  visibleCountMobile?: 3 | 6
  visibleCountDesktop?: 3 | 6
}

export default async function CampaignHotelListing({
  heading,
  hotelIds,
  visibleCountMobile,
  visibleCountDesktop,
}: CampaignHotelListingProps) {
  const hotels = await getHotelsByCSFilter({ hotelsToInclude: hotelIds })

  if (!hotels.length) {
    return null
  }

  return (
    <CampaignHotelListingClient
      heading={heading}
      hotels={hotels}
      visibleCountMobile={visibleCountMobile}
      visibleCountDesktop={visibleCountDesktop}
    />
  )
}
