import SuccessStories from "./success-stories";

import React from "react";

export const metadata = {
  title: "Inspiring Study Abroad Journeys: Real Student Success Stories",
  description: "Follow the inspiring study abroad journeys of successful students. Read real success stories about university admissions, visa success, and life in a new country.",
  siteName: process.env.NEXT_PUBLIC_APP_WEBSITE_NAME,
  openGraph: {
    title: "Inspiring Study Abroad Journeys: Real Student Success Stories",
    description: "Follow the inspiring study abroad journeys of successful students. Read real success stories about university admissions, visa success, and life in a new country.",
    url: `${process.env.NEXT_PUBLIC_APP_URL}/success-stories`,
    siteName: process.env.NEXT_PUBLIC_APP_WEBSITE_NAME,
    type: "website",
  },
  twitter: {
    card: "summary_large_image",
    title: "Inspiring Study Abroad Journeys: Real Student Success Stories",
    description: "Follow the inspiring study abroad journeys of successful students. Read real success stories about university admissions, visa success, and life in a new country.",
  },
  alternates: {
    canonical: `${process.env.NEXT_PUBLIC_APP_URL}/success-stories`,
  },
  robots: {
    index: true,
    follow: true,
    nocache: false,
    googleBot: {
      index: true,
      follow: true,
      noimageindex: false,
      "max-video-preview": -1,
      "max-image-preview": "large",
      "max-snippet": -1,
    },
  },
};

async function fetchData() {
  const response = await fetch(`${process.env.NEXT_PUBLIC_APP_URL}/api/frontend/all-success-stories`, {
    method: "GET",
    cache: 'no-store'
  });

  const data = await response.json();

  return data;
}


export default async function SearchPage() {

    const data = await fetchData();

  return (
    <>
      <SuccessStories stories={data.data} />
    </>
  );
}
