\set ON_ERROR_STOP on
-- Governance/concept companion preflight. Read-only.
-- Run after the mapped rich proposal packet has been applied.

select 'schema_table' as check_name, name, to_regclass(name) as regclass
from (values
  ('public.concept_maps'),
  ('public.claim_concept_map_links'),
  ('public.claim_governance_gate_links')
) as v(name);

select 'required_base_claim' as check_name,
       c.id::text,
       c.status,
       left(c.text, 220) as text
from public.claims c
where c.id in (select id from (values
    ('d009dfc4-9755-58a7-affb-80e3e842a775'::uuid),
    ('9bcf7e6b-4e98-52b1-91ef-96cfc15e3df0'::uuid)
  ) as v(id))
order by c.id;

select 'required_governance_gate' as check_name,
       id::text,
       name,
       left(criteria, 180) as criteria,
       left(evidence_bar, 180) as evidence_bar
from public.governance_gates
where id in (select id from (values
    ('fa88e31b-6fca-4801-bf72-f5db81950a11'::uuid),
    ('45695897-2a9c-4279-ac25-e59f166dec6a'::uuid)
  ) as v(id))
order by name;
