[
  {
    "type": "create_table",
    "description": "Create eventTemplates table for reusable event templates (central database)",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'eventTemplates'",
    "sql": "CREATE TABLE `eventTemplates` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `name` VARCHAR(100) NOT NULL,\n  `description` TEXT NULL,\n  `eventType` ENUM('season', 'holiday', 'sale', 'custom') NOT NULL,\n  `scope` ENUM('global', 'franchise', 'store') DEFAULT 'global',\n  `storeType` VARCHAR(10) NULL COMMENT 'Filter by store type (ou, pa, wi, etc.)',\n  `defaultBuildUpDays` INT UNSIGNED DEFAULT 14,\n  `defaultWindDownDays` INT UNSIGNED DEFAULT 7,\n  `color` VARCHAR(7) NULL,\n  `icon` VARCHAR(50) NULL,\n  `isActive` TINYINT(1) DEFAULT 1,\n  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n  `updated_at` TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  INDEX `idx_scope` (`scope`),\n  INDEX `idx_type` (`eventType`),\n  INDEX `idx_storetype` (`storeType`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Reusable event templates'"
  },
  {
    "type": "create_table",
    "description": "Create eventTemplate_Integrations table for template integration configurations",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'eventTemplate_Integrations'",
    "sql": "CREATE TABLE `eventTemplate_Integrations` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `templateId` INT UNSIGNED NOT NULL,\n  `integrationType` ENUM('backstock', 'sms_blast', 'sms_trigger', 'signage', 'comeback_cash', 'task', 'note') NOT NULL,\n  `config` JSON NOT NULL COMMENT 'Template configuration for this integration type',\n  `relativeDays` INT NULL COMMENT 'Days relative to event start',\n  `isOptional` TINYINT(1) DEFAULT 0 COMMENT 'Can user remove this integration?',\n  `sortOrder` INT UNSIGNED DEFAULT 0,\n  PRIMARY KEY (`id`),\n  INDEX `idx_template` (`templateId`),\n  CONSTRAINT `fk_template` FOREIGN KEY (`templateId`) REFERENCES `eventTemplates`(`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Template integration configurations'"
  }
]
