-- ======================
-- SIGNING: Document
-- ======================
CREATE TABLE "unified_signing_document" (
  "unified_connection_id"  VARCHAR NOT NULL,
  "unified_webhook_id"     VARCHAR NOT NULL,
  "unified_external_xref"  VARCHAR,
  "unified_integration_type" VARCHAR NOT NULL,
  "unified_raw_id"         VARCHAR,
  "unified_id"             VARCHAR NOT NULL,
  "id"                     VARCHAR,
  "created_at"             TIMESTAMP_NTZ,
  "updated_at"             TIMESTAMP_NTZ,
  "name"                   VARCHAR,
  "description"            VARCHAR,
  "status"                 VARCHAR,
  "sent_at"                TIMESTAMP_NTZ,
  "completed_at"           TIMESTAMP_NTZ,
  "expires_at"             TIMESTAMP_NTZ,
  "template_id"            VARCHAR,
  "download_url"           VARCHAR,
  "creator_id"             VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- SIGNING: Signatory
-- ======================
CREATE TABLE "unified_signing_signatory" (
  "unified_connection_id"  VARCHAR NOT NULL,
  "unified_webhook_id"     VARCHAR NOT NULL,
  "unified_external_xref"  VARCHAR,
  "unified_integration_type" VARCHAR NOT NULL,
  "unified_raw_id"         VARCHAR,
  "unified_id"             VARCHAR NOT NULL,
  "id"                     VARCHAR,
  "created_at"             TIMESTAMP_NTZ,
  "updated_at"             TIMESTAMP_NTZ,
  "document_id"            VARCHAR,
  "name"                   VARCHAR,
  "email"                  VARCHAR,
  "role"                   VARCHAR,
  "status"                 VARCHAR,
  "order"                  FLOAT,
  "signed_at"              TIMESTAMP_NTZ,
  "decline_reason"         VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- SIGNING: Template
-- ======================
CREATE TABLE "unified_signing_template" (
  "unified_connection_id"  VARCHAR NOT NULL,
  "unified_webhook_id"     VARCHAR NOT NULL,
  "unified_external_xref"  VARCHAR,
  "unified_integration_type" VARCHAR NOT NULL,
  "unified_raw_id"         VARCHAR,
  "unified_id"             VARCHAR NOT NULL,
  "id"                     VARCHAR,
  "created_at"             TIMESTAMP_NTZ,
  "updated_at"             TIMESTAMP_NTZ,
  "name"                   VARCHAR,
  "description"            VARCHAR,
  "is_active"              BOOLEAN,
  "creator_id"             VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
