import type { RelatedPerson } from 'fhir/r4'; export const GUARDIAN_GRANT_PROTECTED_URL = 'https://akashichealthrecords.com/fhir/StructureDefinition/guardian-grant-protected'; export const GUARDIAN_KEEPS_GRANT_MESSAGE = 'Your parent or guardian keeps this access until you turn 18. Only they or your practice can change it.'; // The server marks this on a minor's own read of a guardian link they may not change or remove. export const guardianKeepsGrant = (person?: RelatedPerson | null): boolean => Boolean(person?.extension?.some((ext) => ext.url === GUARDIAN_GRANT_PROTECTED_URL && ext.valueBoolean === true));