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

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

	// Fetch full account data with schedules, scopes, contacts
	const accountResult = await new GetAccountStore().fetch({
		...fetchParams,
		variables: { id: params.account }
	});

	return {
		accountId: params.account,
		account: accountResult.data?.account ?? null
	};
};
