-- =====================================================================
-- FIGS 强基计划服务 - 样例数据
-- 演示升学服务的完整交付链路: 服务包 → 里程碑模板 → 服务合同 → 里程碑交付推进
-- =====================================================================

SET NAMES utf8mb4;

-- 清理旧样例(按测试ID段)
DELETE FROM `edu_contract_milestone` WHERE contract_id BETWEEN 4100 AND 4199;
DELETE FROM `edu_service_milestone`  WHERE package_id = 3005;
DELETE FROM `edu_contract_log`       WHERE contract_id BETWEEN 4100 AND 4199;
DELETE FROM `edu_contract_package`   WHERE contract_id BETWEEN 4100 AND 4199;
DELETE FROM `edu_contract`           WHERE id BETWEEN 4100 AND 4199;
DELETE FROM `edu_course_package`     WHERE id = 3005;

-- 1. 强基计划全链路服务包 (ID 3005)
INSERT INTO `edu_course_package`(`id`,`tenant_id`,`package_code`,`package_name`,`package_type`,`subject`,`grade`,`total_hours`,`lesson_count`,`valid_days`,`max_students`,`list_price`,`sale_price`,`cost_price`,`gift_hours`,`hours_per_lesson`,`description`,`is_hot`,`is_gift`,`billing_type`,`service_category`,`status`,`remark`,`create_by`,`create_time`) VALUES
(3005,'000000','PKG-STRONGBASE-ALL','强基计划全链路定制','SERVICE','综合','高三',0.00,0,730,1,150000.00,150000.00,40000.00,0.00,0.00,'强基计划全链路定制服务：测评定位→竞赛背书→笔试培训→面试集训→文书+志愿，5对1团队服务，覆盖清北华五强基全流程','Y','N','MILESTONE','STRONG_BASE','0','明星升学产品',1,NOW());

-- 2. 里程碑模板 (5个交付节点)
INSERT INTO `edu_service_milestone`(`id`,`tenant_id`,`package_id`,`milestone_name`,`milestone_code`,`order_num`,`planned_amount`,`planned_hours`,`deliverable_desc`,`status`,`del_flag`,`remark`,`create_by`,`create_time`) VALUES
(3201,'000000',3005,'测评定位','EVAL',1,30000.00,0.00,'3次学情测评 + 目标院校匹配报告 + 个性化规划方案','0','0','第一阶段',1,NOW()),
(3202,'000000',3005,'竞赛/科创背书','COMPETITION',2,40000.00,20.00,'学科竞赛集训或科创项目定制(论文/机器人) + 赛事报名指导','0','0','第二阶段(高一高二全年)',1,NOW()),
(3203,'000000',3005,'校测笔试培训','WRITTEN',3,40000.00,40.00,'笔试知识点梳理 + 目标院校真题专项 + 一校一课定制','0','0','第三阶段(高三/高考后)',1,NOW()),
(3204,'000000',3005,'面试集训','INTERVIEW',4,20000.00,10.00,'线下面试技巧课 + 全真模拟面试(2轮)','0','0','第四阶段(高考后-校测前)',1,NOW()),
(3205,'000000',3005,'文书+志愿','DOC_VOLUNTEER',5,20000.00,0.00,'报名材料打磨 + 个人陈述/推荐信 + 志愿规划 + 录取跟进','0','0','第五阶段(贯穿全程)',1,NOW());

-- 3. 强基服务合同 (赵小明签约, 执行中, ID 4100)
INSERT INTO `edu_contract`(`id`,`tenant_id`,`contract_no`,`student_id`,`contract_type`,`parent_contract_id`,`sign_date`,`effective_date`,`expire_date`,`total_amount`,`discount_amount`,`paid_amount`,`refund_amount`,`total_hours`,`used_hours`,`remain_hours`,`gift_hours`,`payment_method`,`payment_status`,`status`,`sales_id`,`housekeeper_id`,`description`,`signed_at`,`activated_at`,`remark`,`create_by`,`create_time`) VALUES
(4100,'000000','EDUCT20260301001',2001,'ENROLL',NULL,'2026-03-01','2026-03-01','2028-03-01',150000.00,0.00,150000.00,0.00,0.00,0.00,0.00,0.00,'BANK','2','2',1001,1003,'强基计划全链路定制服务(目标:清华大学)','2026-03-01 10:00:00','2026-03-01 10:30:00','升学服务合同, 按里程碑交付',1,'2026-03-01 09:30:00');

-- 4. 合同课包明细 (强基服务包)
INSERT INTO `edu_contract_package`(`id`,`tenant_id`,`contract_id`,`package_id`,`package_name`,`package_type`,`total_hours`,`used_hours`,`remain_hours`,`gift_hours`,`list_price`,`sale_price`,`discount_amount`,`final_amount`,`expire_date`,`status`,`create_by`,`create_time`) VALUES
(4150,'000000',4100,3005,'强基计划全链路定制','SERVICE',0.00,0.00,0.00,0.00,150000.00,150000.00,0.00,150000.00,'2028-03-01','0',1,'2026-03-01 09:30:00');

-- 5. 合同里程碑实例 (前2个已交付, 第3个进行中, 后2个待交付)
INSERT INTO `edu_contract_milestone`(`id`,`tenant_id`,`contract_id`,`package_id`,`milestone_name`,`milestone_code`,`order_num`,`planned_amount`,`paid_amount`,`actual_amount`,`planned_hours`,`status`,`deliverable_url`,`delivered_by`,`delivered_at`,`del_flag`,`remark`,`create_by`,`create_time`) VALUES
(5301,'000000',4100,3005,'测评定位','EVAL',1,30000.00,30000.00,30000.00,0.00,'2','/files/report_2001_eval.pdf',1005,'2026-03-20 16:00:00','0','已出测评报告+规划方案',1,NOW()),
(5302,'000000',4100,3005,'竞赛/科创背书','COMPETITION',2,40000.00,40000.00,40000.00,20.00,'2','/files/competition_2001.pdf',1005,'2026-05-15 17:00:00','0','信息学奥赛省一+科创论文',1,NOW()),
(5303,'000000',4100,3005,'校测笔试培训','WRITTEN',3,40000.00,40000.00,0.00,40.00,'1',NULL,NULL,NULL,'0','笔试培训进行中',1,NOW()),
(5304,'000000',4100,3005,'面试集训','INTERVIEW',4,20000.00,0.00,0.00,10.00,'0',NULL,NULL,NULL,'0','待交付',1,NOW()),
(5305,'000000',4100,3005,'文书+志愿','DOC_VOLUNTEER',5,20000.00,0.00,0.00,0.00,'0',NULL,NULL,NULL,'0','待交付',1,NOW());

-- 6. 合同流水 (创建+激活+2次里程碑交付)
INSERT INTO `edu_contract_log`(`id`,`tenant_id`,`contract_id`,`action`,`amount`,`hours_delta`,`ref_contract_id`,`operator_id`,`operator_name`,`reason`,`log_time`,`create_by`,`create_time`) VALUES
(4350,'000000',4100,'CREATE',150000.00,0.00,NULL,1001,'张伟','创建强基服务合同','2026-03-01 09:30:00',1,'2026-03-01 09:30:00'),
(4351,'000000',4100,'ACTIVATE',150000.00,0.00,NULL,1,'admin','合同激活, 全款支付','2026-03-01 10:30:00',1,'2026-03-01 10:30:00'),
(4352,'000000',4100,'MILESTONE_DELIVER',30000.00,0.00,NULL,1005,'刘洋','里程碑交付: 测评定位(附件已上传)','2026-03-20 16:00:00',1,'2026-03-20 16:00:00'),
(4353,'000000',4100,'MILESTONE_DELIVER',40000.00,20.00,NULL,1005,'刘洋','里程碑交付: 竞赛/科创背书(附件已上传)','2026-05-15 17:00:00',1,'2026-05-15 17:00:00');
