-- 092: Ink-reproduction consent on signature records.
--
-- The Standard (no-login) CMS filing path reproduces the signer's OWN captured
-- signature strokes in real ink on the printed form (pen plotter) so the mailed
-- application carries an original ink signature. Per the legal-risk research
-- (docs/legal/remote-mechanical-wet-signature-precedent.md), the linchpin that
-- keeps this on the valid side of the forgery/agency line is an EXPLICIT,
-- per-document authorization from the signer to reproduce their signature in ink
-- on this specific document.
--
-- These columns capture that consent at signing time, alongside the existing
-- perjury attestation. They are only meaningful for drawn signatures on ink-path
-- documents (metadata.ink_reproduction = true); other docs leave them false/NULL.
--
-- Idempotent.

ALTER TABLE esign_records
    ADD COLUMN IF NOT EXISTS ink_consent      BOOLEAN DEFAULT FALSE,
    ADD COLUMN IF NOT EXISTS ink_consent_at   TIMESTAMPTZ,
    ADD COLUMN IF NOT EXISTS ink_consent_text TEXT;

COMMENT ON COLUMN esign_records.ink_consent IS
    'TRUE when the signer expressly authorized reproducing their drawn signature '
    'in ink on this document (pen-plotter path). Captured at signing time.';
COMMENT ON COLUMN esign_records.ink_consent_at IS
    'When the ink-reproduction consent was given (signer-side timestamp).';
COMMENT ON COLUMN esign_records.ink_consent_text IS
    'Verbatim consent language the signer agreed to (for the audit trail).';
