import ScholarshipsPage from "./scholarships-page";

import React from "react";

export const metadata = {
  title: "Free Scholarships for Pakistani Students | Universities Page",
  description: "Universities Page offers complete info on international scholarships and visa processes. Secure your fully funded future and start studying abroad today!",
  siteName: process.env.NEXT_PUBLIC_APP_WEBSITE_NAME,
  openGraph: {
    title: "Free Scholarships for Pakistani Students | Universities Page",
    description: "Universities Page offers complete info on international scholarships and visa processes. Secure your fully funded future and start studying abroad today!",
    url: `${process.env.NEXT_PUBLIC_APP_URL}/scholarships`,
    siteName: process.env.NEXT_PUBLIC_APP_WEBSITE_NAME,
    locale: "en_US",
    type: "website",
  },
  twitter: {
    card: "summary_large_image",
    title: "Free Scholarships for Pakistani Students | Universities Page",
    description: "Universities Page offers complete info on international scholarships and visa processes. Secure your fully funded future and start studying abroad today!",
  },
  alternates: {
    canonical: `${process.env.NEXT_PUBLIC_APP_URL}/scholarships`,
  },
  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/allscholarships`, {
    method: "GET"
  });

  const data = await response.json();

  return data;
}

export default async function Scholarships() {
  const data = await fetchData();

  return (
    <>
      <ScholarshipsPage scholarships={data.data} />
    </>
  );
}