import { ShieldAlert, ShieldOff } from 'lucide-react'; import type { OrgAuthorizationStatusValue } from '../../../services/OrgAuthorizationService.tsx'; // Phase 2 (clinical-authorization gate), client Task 12 - lightweight front-desk marker on the // receptionist appointments overview (spec ยง7): a listed appointment's patient whose // org-authorization status is NOT `active` gets a small badge so the front desk catches an // un-authorized patient at check-in. `active` (authorized) renders nothing, and so does `undefined` // (status not yet fetched) - an in-flight fetch should never flash a false "not authorized" badge // before the real status is known. // // - A WITHDRAWN PATIENT GETS A DIFFERENT BADGE, AND THE DIFFERENCE IS THE SAFEGUARD. // This badge exists to prompt an action: catch the patient at the desk and get the authorization // captured. That is right for `proposed` and `none` - paperwork that was never done. It is exactly // wrong for a patient who granted authorization and then deliberately took it back, because the // prompted action would UNDO their decision, and an amber "Not authorized" gives the front desk no // way to tell the two apart. Same reason, same wording, as the staff status row's label. const NotAuthorizedBadge = ({ status }: { status?: OrgAuthorizationStatusValue }) => { if (!status || status === 'active') { return null; } // - A DECLINED PATIENT GETS A THIRD BADGE, BY THE SAME ARGUMENT THE WITHDRAWN ONE USES. // An amber "Auth pending" over a patient who was ASKED AND SAID NO tells the desk to go and capture // paperwork that is not outstanding - it is missing, and the patient's own answer is what it is missing. // Pressing them on it at check-in is chasing an answered question, which Spencer ruled out: a decline is // an ANSWER. So this badge REPORTS rather than prompts, and says when they answered nothing about // what to do next. If the patient raises it themselves, the desk can help - that is the whole difference. // SEMANTIC TOKENS, NOT A PALETTE COLOUR, AND THE CHOICE IS THE MEANING RATHER THAN A GATE DODGE. // `--sunken` is the recessed neutral (inset wells, table stripes) and `--ink-muted` is secondary text: // together they read as INFORMATION ON THE ROW, which is exactly this badge's job. Its two neighbours // are palette colours because they are meant to catch an eye - amber says *act on this*, rose says // *something was taken back*. The visual difference is the safeguard, so a neutral that recedes is // the correct third thing, not a compromise. // 4.8:1 - `--ink-muted` #6c665c on `--sunken` #efece6, which passes AA for normal text at this size. // `--faint` would NOT: it is 3.06:1 and is for large text and borders only. if (status === 'declined') { return ( ); } if (status === 'withdrawn') { return ( ); } const label = status === 'proposed' ? 'Auth pending' : 'Not authorized'; return ( ); }; export default NotAuthorizedBadge;