-- 090: Capture the vector (stroke-path) form of a drawn signature.
--
-- Today esign_records.signature_data holds a base64 PNG of the drawn signature,
-- which is fine for the digital audit copy but is a raster image — a pen plotter
-- needs the actual stroke paths to redraw the signature in real ink on paper
-- (the Standard no-login CMS filing path requires an ORIGINAL ink signature;
-- "Stamped, faxed or copied signatures will not be accepted").
--
-- We store the captured strokes as JSON so the same signing event yields both:
--   * signature_data       — base64 PNG  (digital stamp, audit trail)
--   * signature_vector     — stroke paths (drives the pen plotter)
--
-- Format (normalized into a 0..1 box, origin top-left, matching canvas capture):
--   {
--     "v": 1,
--     "w": <canvas css width px>, "h": <canvas css height px>,
--     "strokes": [ [ {"x":0.12,"y":0.40,"t":12}, ... ], ... ]
--   }
-- x/y are fractions of the capture box (resolution-independent); t is ms since
-- stroke start (optional, for future pressure/speed modeling). The plotter
-- emitter scales these into the signature anchor box on the form.

ALTER TABLE esign_records
    ADD COLUMN IF NOT EXISTS signature_vector JSONB;

COMMENT ON COLUMN esign_records.signature_vector IS
    'Stroke-path form of a drawn signature (normalized 0..1, origin top-left). '
    'Drives the pen-plotter ink-signature pipeline. NULL for typed signatures '
    'or signatures captured before this column existed.';
