import { useAuthServiceContext } from '../services/AuthService.tsx'; import { useMyProxies } from './useMyProxies'; import { mayAddToRecordAsProxy, proxyStanding } from '../utils/proxyFormAuthority'; // A helper switched in below full access reads the clinical record but is not offered its writes. A courtesy: // the server refuses those writes either way. export const useProxyCannotAddToRecord = (): boolean => { const { actingAs } = useAuthServiceContext(); const { proxies, listAnswered } = useMyProxies(); if (!actingAs) return false; const tier = proxyStanding(proxies, actingAs.relatedPersonId, listAnswered); return !mayAddToRecordAsProxy(tier); };