--==========================================================================================
-- 76. exam_templates.extraction_meta — trust signal + provenance from the extraction service (P3)
--==========================================================================================
-- Records, per template, how the recognition was produced and whether it reconciled: the audit
-- cover-total gate (cover_total vs detected_total, status, anomaly), the engine + slug used, and
-- region counts. Lets the setup UI show "extraction: cover 100 = detected 100 ✓" (or flag an under-read),
-- and lets the digital-text view resolve the paper's replica by slug. Nullable, defaults to {}.
alter table public.exam_templates add column if not exists extraction_meta jsonb not null default '{}'::jsonb;

comment on column public.exam_templates.extraction_meta is
  'Extraction-service provenance + trust gate: {engine, slug, audit:{cover_total,detected_total,status,anomaly}, counts}.';
