import { AdminProfilesStore } from '$houdini';
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async (event) => {
	const { parent } = event;
	const fetchParams = {
		event,
		metadata: { cookie: event.locals.cookie }
	};

	// Fetch profiles and parent data in parallel
	const [profiles, parentData] = await Promise.all([
		new AdminProfilesStore().fetch(fetchParams),
		parent()
	]);

	return {
		profiles,
		customers: parentData.customers
	};
};
