-- ======================
-- CALENDAR: Calendar
-- ======================
CREATE TABLE "unified_calendar_calendar" (
  "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,
  "timezone"               VARCHAR,
  "is_primary"             BOOLEAN,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- CALENDAR: Event
-- ======================
CREATE TABLE "unified_calendar_event" (
  "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"             VARCHAR,
  "updated_at"             VARCHAR,
  "calendar_id"            VARCHAR,
  "subject"                VARCHAR,
  "start_at"               VARCHAR,
  "end_at"                 VARCHAR,
  "is_all_day"             BOOLEAN,
  "timezone"               VARCHAR,
  "notes"                  VARCHAR,
  "location"               VARCHAR,
  "is_free"                BOOLEAN,
  "is_private"             BOOLEAN,
  "status"                 VARCHAR,
  "organizer"              VARIANT,
  "attendees"              VARIANT,
  "recurring_event_id"     VARCHAR,
  "recurrence"             VARIANT,
  "web_url"                VARCHAR,
  "has_conference"         BOOLEAN,
  "conference"             VARIANT,
  "attachments"            VARIANT,
  "send_notifications"     BOOLEAN,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- CALENDAR: Busy
-- ======================
CREATE TABLE "unified_calendar_busy" (
  "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,
  "start_at"               TIMESTAMP_NTZ,
  "end_at"                 TIMESTAMP_NTZ,
  "timezone"               VARCHAR,
  "description"            VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- CALENDAR: Link
-- ======================
CREATE TABLE "unified_calendar_link" (
  "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"             VARCHAR,
  "updated_at"             VARCHAR,
  "name"                   VARCHAR,
  "url"                    VARCHAR,
  "duration"               FLOAT,
  "description"            VARCHAR,
  "is_active"              BOOLEAN,
  "price_amount"           FLOAT,
  "price_currency"         VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- CALENDAR: Recording
-- ======================
CREATE TABLE "unified_calendar_recording" (
  "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,
  "start_at"               TIMESTAMP_NTZ,
  "end_at"                 TIMESTAMP_NTZ,
  "expires_at"             TIMESTAMP_NTZ,
  "event_id"               VARCHAR,
  "web_url"                VARCHAR,
  "media"                  VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- CALENDAR: Webinar
-- ======================
CREATE TABLE "unified_calendar_webinar" (
  "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,
  "calendar_id"            VARCHAR,
  "subject"                VARCHAR,
  "start_at"               TIMESTAMP_NTZ,
  "end_at"                 TIMESTAMP_NTZ,
  "timezone"               VARCHAR,
  "notes"                  VARCHAR,
  "status"                 VARCHAR,
  "organizer"              VARIANT,
  "join_url"               VARCHAR,
  "web_url"                VARCHAR,
  "panelists"              VARIANT,
  "registrants"            VARIANT,
  "panelist_password"      VARCHAR,
  "registrant_password"    VARCHAR,
  "conference"             VARIANT,
  "recurrence"             VARIANT,
  "capacity"               FLOAT,
  "is_webcast"             BOOLEAN,
  "is_enabled"             BOOLEAN,
  "is_auto_approve"        BOOLEAN,
  "require_first_name"     BOOLEAN,
  "require_last_name"      BOOLEAN,
  "require_email"          BOOLEAN,
  "require_company"        BOOLEAN,
  "require_job_title"      BOOLEAN,
  "require_address"        BOOLEAN,
  "require_phone"          BOOLEAN,
  "has_qa"                 BOOLEAN,
  "has_polls"              BOOLEAN,
  "has_recording"          BOOLEAN,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
