import { requireParticipantContext } from "@/lib/auth/require-participant";
import { getParticipantConsents } from "@/lib/queries/participant-queries";
import { PageHeader } from "@/components/shared/PageHeader";
import { ParticipantSettings } from "@/components/features/participant/ParticipantSettings";

export const dynamic = "force-dynamic";

export default async function ParticipantProfilePage() {
  const { profile } = await requireParticipantContext();
  const consents = await getParticipantConsents(profile.id);

  return (
    <>
      <PageHeader
        title="Profile & Privacy"
        subtitle="Control what you share and how it's used"
      />
      <div className="flex-1 p-4 sm:p-[26px]">
        <ParticipantSettings
          profile={{
            countryCode: profile.countryCode ?? "",
            regionCode: profile.regionCode ?? "",
            ageBand: profile.ageBand ?? "",
          }}
          paused={profile.status === "paused"}
          consents={consents}
        />
      </div>
    </>
  );
}
