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

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

	const fetchParams = { event, metadata: { cookie: locals.cookie } };

	const result = await new GetConversationStore().fetch({
		...fetchParams,
		variables: {
			id: params.conversation,
			messageLimit: 100,
			messageOffset: 0
		}
	});

	return {
		conversation: result
	};
};
