import { error } from '@sveltejs/kit';
import type { GameMode } from '$lib/types';
import type { PageLoad } from './$types';

const MODES: GameMode[] = ['monument', 'lieu', 'defi'];

export const load: PageLoad = ({ params }) => {
	if (!MODES.includes(params.mode as GameMode)) {
		error(404, 'Mode inconnu');
	}
	return { mode: params.mode as GameMode };
};
