-- ======================
-- LMS: Course
-- ======================
CREATE TABLE "unified_lms_course" (
  "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_private"             BOOLEAN,
  "is_active"              BOOLEAN,
  "price_amount"           FLOAT,
  "languages"              VARIANT,
  "categories"             VARIANT,
  "currency"               VARCHAR,
  "media"                  VARIANT,
  "instructor_ids"         VARIANT,
  "instructors"            VARIANT,
  "student_ids"            VARIANT,
  "students"               VARIANT,
  "content_ids"            VARIANT,
  "skills"                 VARIANT,
  "duration_minutes"       FLOAT,
  "provider_name"          VARCHAR,
  "raw"                    VARIANT,
  "published_at"           TIMESTAMP_NTZ,
  "time_estimate_minutes"  FLOAT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- LMS: Class
-- ======================
CREATE TABLE "unified_lms_clas" (
  "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,
  "media"                  VARIANT,
  "course_id"              VARCHAR,
  "instructor_ids"         VARIANT,
  "student_ids"            VARIANT,
  "languages"              VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- LMS: Student
-- ======================
CREATE TABLE "unified_lms_student" (
  "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,
  "first_name"             VARCHAR,
  "last_name"              VARCHAR,
  "emails"                 VARIANT,
  "telephones"             VARIANT,
  "address"                VARIANT,
  "image_url"              VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- LMS: Instructor
-- ======================
CREATE TABLE "unified_lms_instructor" (
  "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,
  "first_name"             VARCHAR,
  "last_name"              VARCHAR,
  "emails"                 VARIANT,
  "title"                  VARCHAR,
  "telephones"             VARIANT,
  "image_url"              VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- LMS: Content
-- ======================
CREATE TABLE "unified_lms_content" (
  "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,
  "external_reference"     VARCHAR,
  "course_ids"             VARIANT,
  "name"                   VARCHAR,
  "description"            VARCHAR,
  "languages"              VARIANT,
  "media"                  VARIANT,
  "is_active"              BOOLEAN,
  "duration_minutes"       FLOAT,
  "categories"             VARIANT,
  "skills"                 VARIANT,
  "sort_order"             FLOAT,
  "provider_name"          VARCHAR,
  "short_description"      VARCHAR,
  "localizations"          VARIANT,
  "instructor_ids"         VARIANT,
  "collection_ids"         VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- LMS: Collection
-- ======================
CREATE TABLE "unified_lms_collection" (
  "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,
  "media"                  VARIANT,
  "is_active"              BOOLEAN,
  "parent_id"              VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- LMS: Activity
-- ======================
CREATE TABLE "unified_lms_activity" (
  "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,
  "content_id"             VARCHAR,
  "course_id"              VARCHAR,
  "student_id"             VARCHAR,
  "duration_minutes"       FLOAT,
  "assigned_grade"         VARCHAR,
  "is_completed"           BOOLEAN,
  "progress_percentage"    FLOAT,
  "started_at"             TIMESTAMP_NTZ,
  "completed_at"           TIMESTAMP_NTZ,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
