-- Orders table for WBU Quote System
CREATE TABLE IF NOT EXISTS `orders` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `order_type` ENUM('AI','AQUALENZ') NOT NULL,
  `status` VARCHAR(50) NOT NULL DEFAULT 'draft',
  `title` VARCHAR(255) DEFAULT NULL,
  `total_amount` DECIMAL(12,2) DEFAULT NULL,
  `order_payload` JSON DEFAULT NULL,
  `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` DATETIME DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_orders_user` (`user_id`),
  KEY `idx_orders_type` (`order_type`),
  KEY `idx_orders_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
