import type { IssueSummary } from "$lib/components/repo/types";
import type { PageLoad } from "./$types";

export const load: PageLoad = async (event) => {
	const parent = await event.parent();
	const state = event.url.searchParams.get("state") === "closed" ? "closed" : "open";

	// TODO: fetch via sh.tangled.repo.listIssues and resolve author handles
	const issues: IssueSummary[] = [];
	const closedCount = 0;

	return {
		state: state as "open" | "closed",
		issues,
		openCount: parent.counts.issues,
		closedCount
	};
};
