-- 0007_bilingual_bureau.sql — bilingual EN+PT-BR sibling columns for the
-- Investigation Bureau (per CLAUDE.md §3: "Narrative descriptions ... Both
-- EN and PT-BR via sibling fields").
--
-- This migration adds nullable `*_pt_br` siblings for every narrative
-- column the bureau writes. Existing rows stay valid; new rows must
-- populate both. The detective prompts get re-flowed in W4 to emit both
-- languages in their JSON output.
--
-- Notes:
--   - public.evidence.verbatim_excerpt stays single-language. Per CLAUDE.md
--     §3, verbatim quotes "preserve source language only".
--   - public.contradictions.chunks JSONB carries `statement` per position;
--     the runtime adds a sibling `statement_pt_br` key per array item
--     (no schema change needed for JSONB shape).
--   - public.gaps.scope JSONB likewise carries `title`, `dominant_model`,
--     `why_surprising`, `what_it_implies` — the runtime adds `*_pt_br`
--     siblings inside the JSONB object.
--
-- Apply as supabase_admin (these tables are owned by supabase_admin
-- per migration 0004 / repo memory).

BEGIN;

ALTER TABLE public.hypotheses
  ADD COLUMN IF NOT EXISTS question_pt_br         TEXT,
  ADD COLUMN IF NOT EXISTS position_pt_br         TEXT,
  ADD COLUMN IF NOT EXISTS argument_for_pt_br     TEXT,
  ADD COLUMN IF NOT EXISTS argument_against_pt_br TEXT;

ALTER TABLE public.contradictions
  ADD COLUMN IF NOT EXISTS topic_pt_br TEXT,
  ADD COLUMN IF NOT EXISTS notes_pt_br TEXT;

ALTER TABLE public.witnesses
  ADD COLUMN IF NOT EXISTS access_to_event_pt_br TEXT,
  ADD COLUMN IF NOT EXISTS bias_notes_pt_br      TEXT,
  ADD COLUMN IF NOT EXISTS verdict_pt_br         TEXT;

ALTER TABLE public.gaps
  ADD COLUMN IF NOT EXISTS description_pt_br         TEXT,
  ADD COLUMN IF NOT EXISTS suggested_next_move_pt_br TEXT;

COMMIT;
