import type { components } from '$lib/generated/api';

type Person = components['schemas']['Person'];
type RelationshipDTO = components['schemas']['RelationshipDTO'];

/**
 * Data the PersonHoverCard needs to render its loaded state.
 * Bundled here so the orchestrator (TranscriptionReadView) and the view
 * (PersonHoverCard) share one canonical shape.
 */
export type HoverData = { person: Person; relationships: RelationshipDTO[] };

/**
 * The hover card's three visible states.
 *
 * `loading`  — initial fetch in flight; skeleton is shown
 * `error`    — fetch failed (non-404, non-OK); generic error message + footer link
 * `loaded`   — fetch succeeded; person + relationships available
 */
export type LoadState =
	| { status: 'loading' }
	| { status: 'error' }
	| { status: 'loaded'; person: Person; relationships: RelationshipDTO[] };
