import { Metadata } from "next";
import { ZammadOverview } from "./_components/ZammadOverview";

const getSection = (overview: string) => {
  return overview.charAt(0).toUpperCase() + overview.slice(1);
};

type MetadataProps = {
  params: Promise<{
    overview: string;
  }>;
};

export async function generateMetadata({
  params,
}: MetadataProps): Promise<Metadata> {
  const { overview } = await params;
  const section = getSection(overview);

  return {
    title: `CDR Link - ${section} Tickets`,
  };
}

type PageProps = {
  params: Promise<{
    overview: string;
  }>;
};

export default async function Page({ params }: PageProps) {
  const { overview } = await params;
  const section = getSection(overview);

  return <ZammadOverview name={section} />;
}
