import { AboutHero } from '@/components/pages/AboutUs/AboutHero'
import { Audience } from '@/components/pages/AboutUs/Audience'
import { RentalConditions } from '@/components/pages/AboutUs/RentalConditions'
import { CurrentPrice } from '@/components/pages/AboutUs/CurrentPrice'
import { ContactSectionForm } from '@/globals/ContactForm/Component'
import config from '@/payload.config'
import { getPayload } from 'payload'
import { AboutUsBenefits } from '@/components/pages/AboutUs/Benefits'
import { getCurrentLocale } from '@/locales/server'

export default async function AboutUsPage() {
  const payloadConfig = await config
  const payload = await getPayload({ config: payloadConfig })
  const locale = await getCurrentLocale()

  const { hero, benefits, audience, currentPrice, rentalConditionals } = await payload.findGlobal({
    slug: 'about-us',
    depth: 1,
    locale,
  })

  return (
    <>
      {hero && <AboutHero {...hero} />}
      {benefits && <AboutUsBenefits {...benefits} />}
      {audience && <Audience {...audience} />}
      {currentPrice && <CurrentPrice {...currentPrice} />}
      {rentalConditionals && <RentalConditions {...rentalConditionals} />}
      <ContactSectionForm />
    </>
  )
}
