import { Hero } from '@/components/sections/home/Hero';
import { OurModels } from '@/components/sections/home/OurModels';
import { ScrollToRegister } from '@/components/sections/home/ScrollToRegister';
import { WeSection } from '@/components/sections/home/WeSection';
import { getCars } from '@/services/cars.service';
import { getHeroBanners } from '@/services/heroBanner.service';

export default async function Home() {
  const carsResponse = await getCars();
  const heroBannerResponse = await getHeroBanners();
  return (
    <main className="space-y-12">
      {!heroBannerResponse.error && (
        <Hero images={heroBannerResponse.images} title={heroBannerResponse.title} />
      )}
      {!carsResponse.error && <OurModels cars={carsResponse.carCards} />}
      <WeSection />
      <ScrollToRegister />
    </main>
  );
}
