import prisma from "@/lib/db";
import CVPageContent from "@/components/CVPageContent";
import { Metadata } from "next";

export const metadata: Metadata = {
    title: "CV | Sergio Hounkpessode",
    description: "Curriculum Vitae de Sergio Hounkpessode, technologue IoT et développeur Fullstack.",
};

export default async function CVPage() {
    // Sequential calls for safety
    const experiences = await (prisma as any).experience.findMany({ orderBy: { startDate: "desc" } });
    const education = await (prisma as any).education.findMany({ orderBy: { startDate: "desc" } });
    const skills = await (prisma as any).skill.findMany({ orderBy: { level: "desc" } });
    const profile = await (prisma as any).profile.findFirst();

    return (
        <CVPageContent
            profile={profile}
            experiences={experiences}
            education={education}
            skills={skills}
        />
    );
}
