-- stitch_soul 导师与预约表
-- 执行：mysql -u user -p db < soul-api/scripts/add-mentors.sql

CREATE TABLE IF NOT EXISTS `mentors` (
  `id` int NOT NULL AUTO_INCREMENT,
  `avatar` varchar(500) DEFAULT '',
  `name` varchar(80) NOT NULL,
  `intro` varchar(500) DEFAULT '',
  `tags` varchar(500) DEFAULT '',
  `price_single` decimal(10,2) DEFAULT NULL,
  `price_half_year` decimal(10,2) DEFAULT NULL,
  `price_year` decimal(10,2) DEFAULT NULL,
  `quote` varchar(500) DEFAULT '',
  `why_find` text,
  `offering` text,
  `judgment_style` varchar(500) DEFAULT '',
  `sort` int DEFAULT 0,
  `enabled` tinyint(1) DEFAULT 1,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_enabled_sort` (`enabled`,`sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `mentor_consultations` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `mentor_id` int NOT NULL,
  `consultation_type` varchar(20) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` varchar(20) DEFAULT 'created',
  `order_id` int DEFAULT NULL,
  `scheduled_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_mentor_id` (`mentor_id`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
