import Head from "next/head";
import { AllegatiComp } from "~/components/area-riservata/allegati";
import { AreaRiservataLayout } from "~/components/Layout";
import type { NextPageWithLayout } from "~/pages/_app";
import { useEnforcedSession } from "~/providers/SessionProvider";

/**
 * Pagina degli allegati: /area-riservata/allegati
 * Mostra gli allegati associati all'utente.
 */
const Allegati: NextPageWithLayout = () => {
	const session = useEnforcedSession();

	return (
		<>
			<Head>
				<title>Allegati - Infoalloggi.it</title>
			</Head>

			<div className="grow p-4">
				<AllegatiComp isAdmin={session.user.isAdmin} userId={session.user.id} />
			</div>
		</>
	);
};
export default Allegati;

export async function getServerSideProps() {
	return {
		props: {},
	};
}

Allegati.getLayout = function getLayout(page) {
	return <AreaRiservataLayout>{page}</AreaRiservataLayout>;
};
