import { formatDatumNl } from '@shared/kernel/datum'; import { WerkvoorraadItem, WerkvoorraadStatus, AanvraagType } from './werkvoorraad-item'; /** View-model mapping for a queue row: type/status → the fields for a CIBG "aanvragen" row. Pure, no Angular — the UI renders these, it does not derive them. */ export const TYPE_LABELS: Record = { registratie: $localize`:@@werkvoorraad.type.registratie:Inschrijving`, herregistratie: $localize`:@@werkvoorraad.type.herregistratie:Herregistratie`, intake: $localize`:@@werkvoorraad.type.intake:Herregistratie-intake`, }; export function statusLabel(status: WerkvoorraadStatus): string { switch (status.tag) { case 'Ingediend': return $localize`:@@werkvoorraad.status.ingediend:Ingediend`; case 'InBehandeling': return status.manual ? $localize`:@@werkvoorraad.status.inBehandelingHandmatig:In behandeling (handmatig)` : $localize`:@@werkvoorraad.status.inBehandeling:In behandeling`; } } export interface WerkvoorraadRow { heading: string; subtitle: string; status: string; } /** Fields for one queue row: type as heading, owner (BSN) as subtitle, status + reference + submit date as the status line. */ export function werkvoorraadRow(item: WerkvoorraadItem): WerkvoorraadRow { const parts = [statusLabel(item.status), item.status.referentie]; if (item.submittedAt) { parts.push( $localize`:@@werkvoorraad.row.ingediend:ingediend op ${formatDatumNl(item.submittedAt)}:datum:`, ); } return { heading: TYPE_LABELS[item.type], subtitle: $localize`:@@werkvoorraad.row.bsn:BSN ${item.owner}:bsn:`, status: parts.join(' · '), }; }