/* Kept apart from `people.ts` (no imports): `attendees/lib/helpers.ts` spreads `guardianSelect` at load time and `people.ts` imports from it. */ /* The adult in charge of a kid (`PersonGuardian`). One per kid in v1: the oldest link wins if there were ever more. */ export const guardianSelect = { guardians: { take: 1, orderBy: { createdAt: 'asc' }, select: { guardian: { select: { id: true, fullName: true, phone: true, email: true } } }, }, } as const; export type GuardianContact = { id: string; fullName: string; phone: string | null; email: string | null }; export type WithGuardians = { guardians?: { guardian: Partial & { phone: string | null } }[] }; export function primaryGuardian(person: { guardians?: { guardian: T }[]; }): T | null { return person.guardians?.[0]?.guardian ?? null; }