-- ========================================
-- ADDITIONAL TABLE: flow_templates
-- ========================================
-- Run this AFTER importing your main database
-- ========================================

USE `whatscrm`;

-- Table structure for table `flow_templates`
CREATE TABLE IF NOT EXISTS `flow_templates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(999) DEFAULT NULL,
  `description` longtext DEFAULT NULL,
  `source` varchar(999) DEFAULT 'whatsapp',
  `data` longtext DEFAULT NULL COMMENT 'JSON data containing nodes and edges',
  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_source` (`source`(100))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Sample data (optional - you can remove if not needed)
-- INSERT INTO `flow_templates` (`title`, `description`, `source`, `data`) VALUES
-- ('Welcome Message', 'Automated welcome message for new customers', 'whatsapp', '{"nodes":[],"edges":[]}'),
-- ('Auto Reply', 'Automatic reply based on keywords', 'whatsapp', '{"nodes":[],"edges":[]}');
