-- AwoooP Phase 7 T15b: inbound event truth-chain columns
--
-- Purpose:
--   Telegram cards are only the notification surface. Operators need a
--   redacted replay envelope for inbound alerts so Alertmanager, Sentry, and
--   SignOz events can be correlated with incidents, approvals, logs, and
--   automation decisions without storing raw secrets or PII.

ALTER TABLE awooop_conversation_event
    ADD COLUMN IF NOT EXISTS content_redacted TEXT,
    ADD COLUMN IF NOT EXISTS redaction_version VARCHAR(32) NOT NULL DEFAULT 'audit_sink_v1',
    ADD COLUMN IF NOT EXISTS source_envelope JSONB NOT NULL DEFAULT '{}'::jsonb;

COMMENT ON COLUMN awooop_conversation_event.content_redacted IS
    'Full inbound event content after audit_sink redaction; raw unredacted payload text is not stored.';

COMMENT ON COLUMN awooop_conversation_event.redaction_version IS
    'Redaction algorithm/version used for content_redacted and source_envelope.';

COMMENT ON COLUMN awooop_conversation_event.source_envelope IS
    'Redacted source metadata for inbound replay/audit, including payload hash, provider, source refs, and log correlation hints.';
