-- ============================================
-- Reading Platform 完整测试数据 SQL
-- ============================================
-- 说明：包含完整的测试数据，涵盖所有主要业务实体
-- 执行方式：mysql -h localhost -u root -p reading_platform < test-data.sql
-- ============================================

USE reading_platform;

-- ============================================
-- 密码哈希说明 (BCrypt)
-- ============================================
-- 密码 "123456" 哈希：$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK
-- 密码 "admin123" 哈希：$2a$10$DyHiv85Fy.yoslnuxVtw/OmsK5gqEAuy1801h6CqyyJnvrecd6VB2
-- ============================================

-- ============================================
-- 1. 主题数据 (t_theme)
-- ============================================
DELETE FROM t_theme;

INSERT INTO t_theme (id, name, display_name, color, icon, sort_order, is_enabled, created_at, deleted) VALUES
('theme001', 'language', '语言与文字', '#FF6B6B', 'icon-language', 1, 1, NOW(), 0),
('theme002', 'math', '数学与逻辑', '#4ECDC4', 'icon-math', 2, 1, NOW(), 0),
('theme003', 'science', '科学探索', '#45B7D1', 'icon-science', 3, 1, NOW(), 0),
('theme004', 'art', '艺术与创造', '#FFA07A', 'icon-art', 4, 1, NOW(), 0),
('theme005', 'social', '社会情感', '#98D8C8', 'icon-social', 5, 1, NOW(), 0),
('theme006', 'health', '健康运动', '#F7DC6F', 'icon-health', 6, 1, NOW(), 0),
('theme007', 'nature', '自然认知', '#82E0AA', 'icon-nature', 7, 1, NOW(), 0);

-- ============================================
-- 2. 管理员账户 (t_admin_user)
-- ============================================
DELETE FROM t_admin_user WHERE username = 'admin';

INSERT INTO t_admin_user (id, username, password, name, email, phone, status, created_at, updated_at, deleted) VALUES
('admin00000000000000000000000001', 'admin', '$2a$10$DyHiv85Fy.yoslnuxVtw/OmsK5gqEAuy1801h6CqyyJnvrecd6VB2', '系统管理员', 'admin@reading.com', '13800138000', 'active', NOW(), NOW(), 0);

-- ============================================
-- 3. 租户数据 (t_tenant) - 幼儿园/机构
-- ============================================
DELETE FROM t_tenant WHERE code IN ('sunshine_kinder', 'hope_kinder', 'star_kinder');

INSERT INTO t_tenant (
    id, name, code, contact_name, contact_phone, contact_email,
    address, logo_url, status, expire_at, max_students, max_teachers,
    created_at, updated_at, deleted
) VALUES
('tenant00000000000000000000001', '阳光幼儿园', 'sunshine_kinder', '张园长', '13800138001', 'sunshine@kinder.com',
 '北京市朝阳区阳光路 100 号', '/uploads/logos/sunshine.png', 'active', DATE_ADD(NOW(), INTERVAL 1 YEAR), 500, 50,
 NOW(), NOW(), 0),
('tenant00000000000000000000002', '希望幼儿园', 'hope_kinder', '李园长', '13800138002', 'hope@kinder.com',
 '北京市海淀区希望路 200 号', '/uploads/logos/hope.png', 'active', DATE_ADD(NOW(), INTERVAL 1 YEAR), 300, 30,
 NOW(), NOW(), 0),
('tenant00000000000000000000003', '星星幼儿园', 'star_kinder', '王园长', '13800138003', 'star@kinder.com',
 '上海市浦东新区星星路 300 号', '/uploads/logos/star.png', 'active', DATE_ADD(NOW(), INTERVAL 1 YEAR), 400, 40,
 NOW(), NOW(), 0);

-- ============================================
-- 4. 教师用户 (t_teacher)
-- ============================================
DELETE FROM t_teacher WHERE username IN ('teacher_wang', 'teacher_li', 'teacher_zhang', 'sunshine_kinder', 'hope_kinder', 'star_kinder');

-- 阳光幼儿园的教师
INSERT INTO t_teacher (
    id, tenant_id, username, password, name, phone, email, gender, bio, status,
    created_at, updated_at, deleted
) VALUES
('teacher000000000000000000001', 'tenant00000000000000000000001', 'teacher_wang', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '王老师', '13900139001', 'wang@kinder.com', 'female', '资深幼儿教师，擅长语言教学', 'active', NOW(), NOW(), 0),
('teacher000000000000000000002', 'tenant00000000000000000000001', 'teacher_li', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '李老师', '13900139002', 'li@kinder.com', 'male', '体育教师，擅长运动游戏', 'active', NOW(), NOW(), 0),
-- 阳光幼儿园学校账号
('school000000000000000000001', 'tenant00000000000000000000001', 'sunshine_kinder', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '阳光幼儿园 - 学校账号', '13800138001', 'sunshine@kinder.com', 'female', NULL, 'active', NOW(), NOW(), 0);

-- 希望幼儿园的教师
INSERT INTO t_teacher (
    id, tenant_id, username, password, name, phone, email, gender, bio, status,
    created_at, updated_at, deleted
) VALUES
('teacher000000000000000000003', 'tenant00000000000000000000002', 'teacher_zhang', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '张老师', '13900139003', 'zhang@kinder.com', 'female', '美术教师，擅长创意绘画', 'active', NOW(), NOW(), 0),
-- 希望幼儿园学校账号
('school000000000000000000002', 'tenant00000000000000000000002', 'hope_kinder', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '希望幼儿园 - 学校账号', '13800138002', 'hope@kinder.com', 'male', NULL, 'active', NOW(), NOW(), 0);

-- 星星幼儿园的教师
INSERT INTO t_teacher (
    id, tenant_id, username, password, name, phone, email, gender, bio, status,
    created_at, updated_at, deleted
) VALUES
('teacher000000000000000000004', 'tenant00000000000000000000003', 'teacher_chen', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '陈老师', '13900139004', 'chen@kinder.com', 'female', '音乐教师，擅长儿歌教学', 'active', NOW(), NOW(), 0),
-- 星星幼儿园学校账号
('school000000000000000000003', 'tenant00000000000000000000003', 'star_kinder', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '星星幼儿园 - 学校账号', '13800138003', 'star@kinder.com', 'female', NULL, 'active', NOW(), NOW(), 0);

-- ============================================
-- 5. 家长用户 (t_parent)
-- ============================================
DELETE FROM t_parent WHERE username IN ('parent_zhang', 'parent_liu', 'parent_wang', 'parent_chen', 'parent_lin');

INSERT INTO t_parent (
    id, tenant_id, username, password, name, phone, email, gender, status,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园的家长
('parent000000000000000000001', 'tenant00000000000000000000001', 'parent_zhang', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '张先生', '13700137001', 'zhang@qq.com', 'male', 'active', NOW(), NOW(), 0),
('parent000000000000000000002', 'tenant00000000000000000000001', 'parent_liu', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '刘女士', '13700137002', 'liu@qq.com', 'female', 'active', NOW(), NOW(), 0),
('parent000000000000000000003', 'tenant00000000000000000000001', 'parent_wang', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '王女士', '13700137003', 'wang@qq.com', 'female', 'active', NOW(), NOW(), 0),
-- 希望幼儿园的家长
('parent000000000000000000004', 'tenant00000000000000000000002', 'parent_chen', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '陈先生', '13700137004', 'chen@qq.com', 'male', 'active', NOW(), NOW(), 0),
-- 星星幼儿园的家长
('parent000000000000000000005', 'tenant00000000000000000000003', 'parent_lin', '$2a$10$RmNcSVt0dBD7uYIuAcbUpuY74jTLFYo8dUOUi6NXRSf4UmGxCaxCK',
 '林女士', '13700137005', 'lin@qq.com', 'female', 'active', NOW(), NOW(), 0);

-- ============================================
-- 6. 班级数据 (t_clazz)
-- ============================================
DELETE FROM t_clazz WHERE tenant_id IN ('tenant00000000000000000000001', 'tenant00000000000000000000002', 'tenant00000000000000000000003');

-- 阳光幼儿园的班级
INSERT INTO t_clazz (
    id, tenant_id, name, grade, description, capacity, status,
    created_at, updated_at, deleted
) VALUES
('class000000000000000000001', 'tenant00000000000000000000001', '大（一）班', '大班', '2019 年出生的小朋友', 35, 'active', NOW(), NOW(), 0),
('class000000000000000000002', 'tenant00000000000000000000001', '大（二）班', '大班', '2019 年出生的小朋友', 30, 'active', NOW(), NOW(), 0),
('class000000000000000000003', 'tenant00000000000000000000001', '中（一）班', '中班', '2020 年出生的小朋友', 30, 'active', NOW(), NOW(), 0),
('class000000000000000000004', 'tenant00000000000000000000001', '小（一）班', '小班', '2021 年出生的小朋友', 25, 'active', NOW(), NOW(), 0),
-- 希望幼儿园的班级
('class000000000000000000005', 'tenant00000000000000000000002', '大（一）班', '大班', '2019 年出生的小朋友', 32, 'active', NOW(), NOW(), 0),
('class000000000000000000006', 'tenant00000000000000000000002', '中（一）班', '中班', '2020 年出生的小朋友', 28, 'active', NOW(), NOW(), 0),
-- 星星幼儿园的班级
('class000000000000000000007', 'tenant00000000000000000000003', '大（一）班', '大班', '2019 年出生的小朋友', 30, 'active', NOW(), NOW(), 0),
('class000000000000000000008', 'tenant00000000000000000000003', '中（一）班', '中班', '2020 年出生的小朋友', 28, 'active', NOW(), NOW(), 0);

-- ============================================
-- 7. 班级 - 教师关联 (t_class_teacher)
-- ============================================
DELETE FROM t_class_teacher;

INSERT INTO t_class_teacher (
    id, class_id, teacher_id, role, is_primary, sort_order,
    created_at, updated_at, deleted
) VALUES
-- 大（一）班 - 王老师（班主任）
('ct000000000000000000001', 'class000000000000000000001', 'teacher000000000000000000001', 'head_teacher', 1, 1, NOW(), NOW(), 0),
-- 中（一）班 - 李老师（班主任）
('ct000000000000000000002', 'class000000000000000000003', 'teacher000000000000000000002', 'head_teacher', 1, 1, NOW(), NOW(), 0),
-- 希望幼儿园
('ct000000000000000000003', 'class000000000000000000005', 'teacher000000000000000000003', 'head_teacher', 1, 1, NOW(), NOW(), 0),
-- 星星幼儿园
('ct000000000000000000004', 'class000000000000000000007', 'teacher000000000000000000004', 'head_teacher', 1, 1, NOW(), NOW(), 0);

-- ============================================
-- 8. 学生数据 (t_student)
-- ============================================
DELETE FROM t_student WHERE tenant_id IN ('tenant00000000000000000000001', 'tenant00000000000000000000002', 'tenant00000000000000000000003');

-- 阳光幼儿园的学生
INSERT INTO t_student (
    id, tenant_id, name, gender, birth_date, avatar_url, grade, student_no,
    reading_level, interests, notes, status, class_id, parent_name, parent_phone,
    reading_count, lesson_count,
    created_at, updated_at, deleted
) VALUES
-- 大（一）班学生
('student00000000000000000001', 'tenant00000000000000000000001', '小明', 'male', '2019-05-15', '/uploads/avatars/student1.png',
 '大班', 'S2024001', '中级', '阅读、画画、积木', '活泼好动，喜欢提问', 'active', 'class000000000000000000001', '张先生', '13700137001', 0, 0, NOW(), NOW(), 0),
('student00000000000000000002', 'tenant00000000000000000000001', '小红', 'female', '2019-08-20', '/uploads/avatars/student2.png',
 '大班', 'S2024002', '高级', '阅读、唱歌、跳舞', '文静乖巧，记忆力好', 'active', 'class000000000000000000001', '刘女士', '13700137002', 0, 0, NOW(), NOW(), 0),
-- 中（一）班学生
('student00000000000000000003', 'tenant00000000000000000000001', '小强', 'male', '2020-02-10', '/uploads/avatars/student3.png',
 '中班', 'S2024003', '初级', '运动、游戏', '性格开朗，喜欢集体活动', 'active', 'class000000000000000000003', '王女士', '13700137003', 0, 0, NOW(), NOW(), 0),
('student00000000000000000004', 'tenant00000000000000000000001', '小丽', 'female', '2020-06-18', '/uploads/avatars/student4.png',
 '中班', 'S2024004', '中级', '画画、手工', '细心认真', 'active', 'class000000000000000000003', '刘女士', '13700137002', 0, 0, NOW(), NOW(), 0),
-- 希望幼儿园的学生
('student00000000000000000005', 'tenant00000000000000000000002', '小刚', 'male', '2019-11-05', '/uploads/avatars/student5.png',
 '大班', 'S2024005', '中级', '足球、跑步', '运动能力强', 'active', 'class000000000000000000005', '陈先生', '13700137004', 0, 0, NOW(), NOW(), 0),
-- 星星幼儿园的学生
('student00000000000000000006', 'tenant00000000000000000000003', '小美', 'female', '2020-03-22', '/uploads/avatars/student6.png',
 '中班', 'S2024006', '高级', '音乐、舞蹈', '节奏感好', 'active', 'class000000000000000000007', '林女士', '13700137005', 0, 0, NOW(), NOW(), 0);

-- ============================================
-- 9. 家长 - 学生关联 (t_parent_student)
-- ============================================
DELETE FROM t_parent_student;

INSERT INTO t_parent_student (
    id, parent_id, student_id, relationship, is_primary,
    created_at, deleted, created_by
) VALUES
-- 张先生 - 小明（父子）
('ps000000000000000000001', 'parent000000000000000000001', 'student00000000000000000001', 'father', 1, NOW(), 0, 'system'),
-- 刘女士 - 小红、小强、小丽（母子）
('ps000000000000000000002', 'parent000000000000000000002', 'student00000000000000000002', 'mother', 1, NOW(), 0, 'system'),
('ps000000000000000000003', 'parent000000000000000000002', 'student00000000000000000004', 'mother', 1, NOW(), 0, 'system'),
-- 王女士 - 小强（母子）
('ps000000000000000000004', 'parent000000000000000000003', 'student00000000000000000003', 'mother', 1, NOW(), 0, 'system'),
-- 陈先生 - 小刚（父子）
('ps000000000000000000005', 'parent000000000000000000004', 'student00000000000000000005', 'father', 1, NOW(), 0, 'system'),
-- 林女士 - 小美（母子）
('ps000000000000000000006', 'parent000000000000000000005', 'student00000000000000000006', 'mother', 1, NOW(), 0, 'system');

-- ============================================
-- 10. 课程数据 (t_course)
-- ============================================
DELETE FROM t_course WHERE tenant_id IN ('tenant00000000000000000000001', 'tenant00000000000000000000002', 'tenant00000000000000000000003');

INSERT INTO t_course (
    id, tenant_id, name, code, description, cover_url, category, age_range,
    difficulty_level, duration_minutes, objectives, status, is_system,
    theme_id, picture_book_name, version, is_latest,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园的课程
('course00000000000000000001', 'tenant00000000000000000000001',
 '绘本阅读入门', 'READ001',
 '适合大班幼儿的绘本阅读课程，培养孩子的阅读兴趣和基础阅读能力',
 '/uploads/courses/reading101.png', 'language', '5-6 岁',
 'beginner', 30,
 '培养阅读兴趣、提升语言表达能力、增强想象力', 'published', 0,
 'theme001', '《猜猜我有多爱你》', '1.0', 1,
 NOW(), NOW(), 0),

('course00000000000000000002', 'tenant00000000000000000000001',
 '趣味数学游戏', 'MATH001',
 '通过游戏的方式学习基础数学概念',
 '/uploads/courses/math101.png', 'math', '4-5 岁',
 'beginner', 25,
 '认识数字、学习简单加减法、培养逻辑思维', 'published', 0,
 'theme002', NULL, '1.0', 1,
 NOW(), NOW(), 0),

('course00000000000000000003', 'tenant00000000000000000000001',
 '创意美术工坊', 'ART001',
 '激发孩子创造力的美术课程',
 '/uploads/courses/art101.png', 'art', '4-6 岁',
 'beginner', 40,
 '培养审美能力、提升创造力、锻炼动手能力', 'published', 0,
 'theme004', NULL, '1.0', 1,
 NOW(), NOW(), 0),

-- 希望幼儿园的课程
('course00000000000000000004', 'tenant00000000000000000000002',
 '科学小实验', 'SCI001',
 '有趣的科学启蒙实验课程',
 '/uploads/courses/science101.png', 'science', '5-6 岁',
 'beginner', 35,
 '培养科学兴趣、锻炼观察能力、学习科学方法', 'published', 0,
 'theme003', NULL, '1.0', 1,
 NOW(), NOW(), 0);

-- ============================================
-- 11. 课程课时数据 (t_course_lesson)
-- ============================================
DELETE FROM t_course_lesson WHERE course_id IN ('course00000000000000000001', 'course00000000000000000002');

INSERT INTO t_course_lesson (
    id, course_id, title, description, content, sort_order, lesson_order, duration_minutes, status,
    created_at, updated_at, deleted
) VALUES
-- 绘本阅读入门 - 6 个课时
('lesson00000000000000000001', 'course00000000000000000001', '第一讲：认识绘本', '了解绘本的结构和特点', '绘本是由图画和文字组成的儿童读物...', 1, 1, 15, 'published', NOW(), NOW(), 0),
('lesson00000000000000000002', 'course00000000000000000001', '第二讲：封面故事', '从封面猜测故事内容', '封面是绘本的第一页，通常包含书名...', 2, 2, 15, 'published', NOW(), NOW(), 0),
('lesson00000000000000000003', 'course00000000000000000001', '第三讲：角色认知', '认识故事中的主要角色', '每个故事都有主角和配角...', 3, 3, 15, 'published', NOW(), NOW(), 0),
('lesson00000000000000000004', 'course00000000000000000001', '第四讲：情节理解', '理解故事的发展脉络', '故事通常有开始、发展、高潮和结局...', 4, 4, 15, 'published', NOW(), NOW(), 0),
('lesson00000000000000000005', 'course00000000000000000001', '第五讲：情感体验', '感受故事中的情感表达', '故事中的角色会有各种情感...', 5, 5, 15, 'published', NOW(), NOW(), 0),
('lesson00000000000000000006', 'course00000000000000000001', '第六讲：创意延伸', '发挥想象，创编故事结局', '如果你是作者，会给故事一个什么样的结局？...', 6, 6, 15, 'published', NOW(), NOW(), 0),
-- 趣味数学游戏 - 5 个课时
('lesson00000000000000000007', 'course00000000000000000002', '第一讲：数字歌', '学习数字 1-10', '1 像铅笔细又长，2 像小鸭水上漂...', 1, 1, 12, 'published', NOW(), NOW(), 0),
('lesson00000000000000000008', 'course00000000000000000002', '第二讲：比大小', '认识大小概念', '哪个苹果大？哪个橘子小？...', 2, 2, 12, 'published', NOW(), NOW(), 0),
('lesson00000000000000000009', 'course00000000000000000002', '第三讲：数一数', '练习点数', '一起数一数有几个苹果...', 3, 3, 12, 'published', NOW(), NOW(), 0),
('lesson00000000000000000010', 'course00000000000000000002', '第四讲：简单加法', '学习 5 以内加法', '1 个苹果加上 2 个苹果等于几个苹果？...', 4, 4, 12, 'published', NOW(), NOW(), 0),
('lesson00000000000000000011', 'course00000000000000000002', '第五讲：简单减法', '学习 5 以内减法', '5 个苹果吃掉了 2 个，还剩几个？...', 5, 5, 12, 'published', NOW(), NOW(), 0);

-- ============================================
-- 12. 课时教学活动 (t_lesson)
-- ============================================
DELETE FROM t_lesson WHERE tenant_id = 'tenant00000000000000000000001';

INSERT INTO t_lesson (
    id, tenant_id, course_id, class_id, teacher_id, title, lesson_date, start_time, end_time,
    location, status, notes,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园 - 大（一）班的课时
('tlesson0000000000000000001', 'tenant00000000000000000000001', 'course00000000000000000001', 'class000000000000000000001', 'teacher000000000000000000001',
 '绘本阅读 - 第 1 课', DATE_ADD(NOW(), INTERVAL 1 DAY), '09:00:00', '09:30:00',
 '大一班教室', 'scheduled', '请小朋友们提前准备好绘本',
 NOW(), NOW(), 0),
('tlesson0000000000000000002', 'tenant00000000000000000000001', 'course00000000000000000001', 'class000000000000000000001', 'teacher000000000000000000001',
 '绘本阅读 - 第 2 课', DATE_ADD(NOW(), INTERVAL 8 DAY), '09:00:00', '09:30:00',
 '大一班教室', 'scheduled', '请小朋友们提前准备好绘本',
 NOW(), NOW(), 0),
('tlesson0000000000000000003', 'tenant00000000000000000000001', 'course00000000000000000001', 'class000000000000000000001', 'teacher000000000000000000001',
 '绘本阅读 - 第 3 课', DATE_ADD(NOW(), INTERVAL 15 DAY), '09:00:00', '09:30:00',
 '大一班教室', 'scheduled', '请小朋友们提前准备好绘本',
 NOW(), NOW(), 0),
('tlesson0000000000000000004', 'tenant00000000000000000000001', 'course00000000000000000002', 'class000000000000000000001', 'teacher000000000000000000001',
 '趣味数学 - 第 1 课', DATE_ADD(NOW(), INTERVAL 2 DAY), '10:00:00', '10:25:00',
 '大一班教室', 'scheduled', '请准备好数字卡片',
 NOW(), NOW(), 0);

-- ============================================
-- 13. 任务数据 (t_task)
-- ============================================
DELETE FROM t_task WHERE tenant_id = 'tenant00000000000000000000001';

INSERT INTO t_task (
    id, tenant_id, title, name, description, type, course_id, creator_id, creator_role,
    start_date, due_date, status,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园的任务
('task000000000000000000001', 'tenant00000000000000000000001',
 '阅读打卡第 1 周', '阅读打卡',
 '请家长陪同孩子每天阅读 15 分钟，并记录阅读内容', 'reading',
 'course00000000000000000001', 'teacher000000000000000000001', 'teacher',
 DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 7 DAY), 'published',
 NOW(), NOW(), 0),

('task000000000000000000002', 'tenant00000000000000000000001',
 '绘画作业：我喜欢的故事角色', '绘画作业',
 '画出你最喜欢的故事角色，并说明理由', 'homework',
 'course00000000000000000001', 'teacher000000000000000000001', 'teacher',
 DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 5 DAY), 'published',
 NOW(), NOW(), 0),

('task000000000000000000003', 'tenant00000000000000000000001',
 '周末亲子活动', '亲子活动',
 '周末和孩子一起去图书馆或书店', 'activity',
 'course00000000000000000001', 'teacher000000000000000000001', 'teacher',
 DATE_ADD(NOW(), INTERVAL 5 DAY), DATE_ADD(NOW(), INTERVAL 7 DAY), 'published',
 NOW(), NOW(), 0);

-- ============================================
-- 14. 任务模板 (t_task_template)
-- ============================================
DELETE FROM t_task_template WHERE tenant_id = 'tenant00000000000000000000001';

INSERT INTO t_task_template (
    id, tenant_id, name, description, type, content, is_public,
    created_at, updated_at, deleted
) VALUES
('template000000000000000001', 'tenant00000000000000000000001',
 '阅读打卡模板', '用于日常阅读打卡记录', 'reading',
 '请记录今天的阅读内容：\n1. 书名：\n2. 阅读时间：\n3. 最喜欢的情节：\n4. 收获：', 1,
 NOW(), NOW(), 0),

('template000000000000000002', 'tenant00000000000000000000001',
 '绘画作业模板', '用于美术类作业', 'homework',
 '请上传孩子的绘画作品，并附上说明：\n1. 作品名称：\n2. 创作灵感：\n3. 使用的材料：', 1,
 NOW(), NOW(), 0),

('template000000000000000003', 'tenant00000000000000000000001',
 '亲子活动模板', '用于记录亲子活动', 'activity',
 '请分享活动过程和感受：\n1. 活动名称：\n2. 活动时间：\n3. 活动内容：\n4. 孩子收获：\n5. 家长感受：', 1,
 NOW(), NOW(), 0),

('template000000000000000004', 'tenant00000000000000000000001',
 '观察记录模板', '用于观察类作业', 'homework',
 '请记录观察到的现象：\n1. 观察对象：\n2. 观察时间：\n3. 观察地点：\n4. 发现：\n5. 思考：', 1,
 NOW(), NOW(), 0);

-- ============================================
-- 15. 通知数据 (t_notification)
-- ============================================
DELETE FROM t_notification WHERE tenant_id = 'tenant00000000000000000000001';

INSERT INTO t_notification (
    id, tenant_id, title, content, type, sender_id, sender_role, recipient_type, recipient_id, is_read,
    created_at, deleted
) VALUES
('notify0000000000000000001', 'tenant00000000000000000000001',
 '新学期开始通知', '亲爱的家长们，新学期即将开始，请做好入园准备。', 'system',
 NULL, NULL, 'all', NULL, 0,
 NOW(), 0),

('notify0000000000000000002', 'tenant00000000000000000000001',
 '绘本阅读课程更新', '《猜猜我有多爱你》课程已更新，请查看。', 'course',
 'teacher000000000000000000001', 'teacher', 'all', NULL, 0,
 NOW(), 0),

('notify0000000000000000003', 'tenant00000000000000000000001',
 '新任务发布', '本周的阅读打卡任务已发布，请家长陪同完成。', 'task',
 'teacher000000000000000000001', 'teacher', 'parent', 'parent000000000000000000001', 0,
 NOW(), 0);

-- ============================================
-- 16. 课表计划 (t_schedule_plan)
-- ============================================
DELETE FROM t_schedule_plan WHERE tenant_id = 'tenant00000000000000000000001';

INSERT INTO t_schedule_plan (
    id, tenant_id, name, class_id, course_id, teacher_id,
    day_of_week, period, start_time, end_time,
    start_date, end_date, location, status,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园 - 大（一）班课表
('schedule000000000000000001', 'tenant00000000000000000000001',
 '绘本阅读课', 'class000000000000000000001', 'course00000000000000000001', 'teacher000000000000000000001',
 1, 1, '09:00:00', '09:30:00',
 DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 120 DAY), '大一班教室', 'active',
 NOW(), NOW(), 0),

('schedule000000000000000002', 'tenant00000000000000000000001',
 '绘本阅读课', 'class000000000000000000001', 'course00000000000000000001', 'teacher000000000000000000001',
 3, 2, '10:00:00', '10:30:00',
 DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 120 DAY), '大一班教室', 'active',
 NOW(), NOW(), 0),

('schedule000000000000000003', 'tenant00000000000000000000001',
 '趣味数学', 'class000000000000000000001', 'course00000000000000000002', 'teacher000000000000000000001',
 2, 1, '09:00:00', '09:25:00',
 DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 120 DAY), '大一班教室', 'active',
 NOW(), NOW(), 0),

('schedule000000000000000004', 'tenant00000000000000000000001',
 '创意美术', 'class000000000000000000001', 'course00000000000000000003', 'teacher000000000000000000001',
 5, 1, '09:00:00', '09:40:00',
 DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 120 DAY), '大一班教室', 'active',
 NOW(), NOW(), 0);

-- ============================================
-- 17. 成长记录 (t_growth_record)
-- ============================================
DELETE FROM t_growth_record WHERE tenant_id = 'tenant00000000000000000000001';

INSERT INTO t_growth_record (
    id, tenant_id, student_id, type, title, content, images,
    recorded_by, recorder_role, record_date, tags,
    created_at, updated_at, deleted
) VALUES
('growth000000000000000001', 'tenant00000000000000000000001', 'student00000000000000000001',
 'reading', '第一次独立阅读', '今天小明第一次独立读完了一本绘本，非常棒！', NULL,
 'teacher000000000000000000001', 'teacher', DATE_ADD(NOW(), INTERVAL -1 DAY),
 '["阅读进步"]',
 NOW(), NOW(), 0),

('growth000000000000000002', 'tenant00000000000000000000001', 'student00000000000000000001',
 'behavior', '帮助同学', '小明主动帮助摔倒的同学，很有爱心', NULL,
 'teacher000000000000000000001', 'teacher', DATE_ADD(NOW(), INTERVAL -2 DAY),
 '["品德表现"]',
 NOW(), NOW(), 0),

('growth000000000000000003', 'tenant00000000000000000000001', 'student00000000000000000002',
 'achievement', '绘画比赛获奖', '在幼儿园绘画比赛中获得一等奖', NULL,
 'teacher000000000000000000001', 'teacher', DATE_ADD(NOW(), INTERVAL -3 DAY),
 '["荣誉奖项"]',
 NOW(), NOW(), 0),

('growth000000000000000004', 'tenant00000000000000000000001', 'student00000000000000000003',
 'reading', '阅读小达人', '本月累计阅读 20 本绘本', NULL,
 'teacher000000000000000000002', 'teacher', DATE_ADD(NOW(), INTERVAL -1 DAY),
 '["阅读进步"]',
 NOW(), NOW(), 0);

-- ============================================
-- 18. 资源库 (t_resource_library)
-- ============================================
DELETE FROM t_resource_library WHERE tenant_id IN ('tenant00000000000000000000001', 'tenant00000000000000000000002', 'tenant00000000000000000000003');

INSERT INTO t_resource_library (
    id, tenant_id, name, description, type,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园的资源库
('lib000000000000000000001', 'tenant00000000000000000000001', '绘本图书馆', '幼儿园绘本电子资源库', 'book', NOW(), NOW(), 0),
('lib000000000000000000002', 'tenant00000000000000000000001', '教学材料库', '教学活动所需材料库', 'material', NOW(), NOW(), 0),
('lib000000000000000000003', 'tenant00000000000000000000001', '体育器材库', '户外运动器材库', 'equipment', NOW(), NOW(), 0),
-- 希望幼儿园的资源库
('lib000000000000000000004', 'tenant00000000000000000000002', '绘本图书馆', '幼儿园绘本电子资源库', 'book', NOW(), NOW(), 0),
('lib000000000000000000005', 'tenant00000000000000000000002', '科学实验库', '科学实验材料库', 'material', NOW(), NOW(), 0),
-- 星星幼儿园的资源库
('lib000000000000000000006', 'tenant00000000000000000000003', '绘本图书馆', '幼儿园绘本电子资源库', 'book', NOW(), NOW(), 0),
('lib000000000000000000007', 'tenant00000000000000000000003', '音乐资源库', '儿歌和音乐资源', 'material', NOW(), NOW(), 0);

-- ============================================
-- 19. 资源项 (t_resource_item)
-- ============================================
DELETE FROM t_resource_item WHERE library_id IN ('lib000000000000000000001', 'lib000000000000000000002', 'lib000000000000000000004');

INSERT INTO t_resource_item (
    id, library_id, tenant_id, type, name, code, description, quantity, available_quantity, location, status,
    created_at, updated_at, deleted
) VALUES
-- 绘本图书馆的资源
('item00000000000000000001', 'lib000000000000000000001', 'tenant00000000000000000000001', 'book',
 '《猜猜我有多爱你》', 'BOOK001', '经典绘本，表达爱意', 5, 3, 'A 区 -1 架', 'available', NOW(), NOW(), 0),
('item00000000000000000002', 'lib000000000000000000001', 'tenant00000000000000000000001', 'book',
 '《好饿的毛毛虫》', 'BOOK002', '成长主题绘本', 5, 5, 'A 区 -1 架', 'available', NOW(), NOW(), 0),
('item00000000000000000003', 'lib000000000000000000001', 'tenant00000000000000000000001', 'book',
 '《大卫上学去》', 'BOOK003', '校园生活绘本', 4, 2, 'A 区 -2 架', 'available', NOW(), NOW(), 0),
('item00000000000000000004', 'lib000000000000000000001', 'tenant00000000000000000000001', 'book',
 '《我爸爸》', 'BOOK004', '亲情主题绘本', 6, 6, 'A 区 -2 架', 'available', NOW(), NOW(), 0),
('item00000000000000000005', 'lib000000000000000000001', 'tenant00000000000000000000001', 'book',
 '《我妈妈》', 'BOOK005', '亲情主题绘本', 6, 4, 'A 区 -2 架', 'available', NOW(), NOW(), 0),
-- 教学材料库的资源
('item00000000000000000006', 'lib000000000000000000002', 'tenant00000000000000000000001', 'material',
 '彩色卡纸', 'MAT001', '美工课用彩色卡纸', 100, 80, 'B 区 -1 柜', 'available', NOW(), NOW(), 0),
('item00000000000000000007', 'lib000000000000000000002', 'tenant00000000000000000000001', 'material',
 '儿童安全剪刀', 'MAT002', '圆头安全剪刀', 35, 30, 'B 区 -1 柜', 'available', NOW(), NOW(), 0),
('item00000000000000000008', 'lib000000000000000000002', 'tenant00000000000000000000001', 'material',
 '水彩笔', 'MAT003', '12 色水彩笔', 50, 45, 'B 区 -2 柜', 'available', NOW(), NOW(), 0),
-- 希望幼儿园绘本馆
('item00000000000000000009', 'lib000000000000000000004', 'tenant00000000000000000000002', 'book',
 '《猜猜我有多爱你》', 'BOOK001', '经典绘本，表达爱意', 5, 5, 'A 区 -1 架', 'available', NOW(), NOW(), 0),
('item00000000000000000010', 'lib000000000000000000004', 'tenant00000000000000000000002', 'book',
 '《蚯蚓的日记》', 'BOOK006', '有趣的生命教育绘本', 4, 4, 'A 区 -1 架', 'available', NOW(), NOW(), 0);

-- ============================================
-- 20. 课程包 (t_course_package)
-- ============================================
DELETE FROM t_course_package;

INSERT INTO t_course_package (
    id, name, description, cover_url, course_count, price, status, is_system,
    created_at, updated_at, deleted
) VALUES
-- 系统课程包
('pkg000000000000000000001', '语言启蒙课程包', '适合 3-6 岁幼儿的语言启蒙课程，包含绘本阅读、儿歌、故事等内容',
 '/uploads/packages/lang_pack.png', 12, 299.00, 'active', 1,
 NOW(), NOW(), 0),
('pkg000000000000000000002', '数学思维课程包', '培养幼儿数学思维能力，包含数概念、图形、逻辑等内容',
 '/uploads/packages/math_pack.png', 10, 269.00, 'active', 1,
 NOW(), NOW(), 0),
('pkg000000000000000000003', '艺术创想课程包', '激发幼儿艺术创造力，包含绘画、手工、音乐等内容',
 '/uploads/packages/art_pack.png', 8, 239.00, 'active', 1,
 NOW(), NOW(), 0),
('pkg000000000000000000004', '科学探索课程包', '培养幼儿科学探索精神，包含实验、观察、发现等内容',
 '/uploads/packages/science_pack.png', 10, 279.00, 'active', 1,
 NOW(), NOW(), 0),
('pkg000000000000000000005', '社交情感课程包', '帮助幼儿发展社交情感能力，包含情绪管理、人际交往等内容',
 '/uploads/packages/social_pack.png', 6, 199.00, 'active', 1,
 NOW(), NOW(), 0),
-- 幼儿园自定义课程包
('pkg000000000000000000006', '阳光幼儿园 - 大班语言包', '阳光幼儿园大班专用语言课程包',
 '/uploads/packages/sunshine_lang.png', 8, 199.00, 'active', 0,
 NOW(), NOW(), 0),
('pkg000000000000000000007', '希望幼儿园 - 科学启蒙包', '希望幼儿园特色科学启蒙课程包',
 '/uploads/packages/hope_science.png', 6, 169.00, 'active', 0,
 NOW(), NOW(), 0);

-- ============================================
-- 21. 租户 - 课程关联 (t_tenant_course)
-- ============================================
DELETE FROM t_tenant_course;

INSERT INTO t_tenant_course (
    id, tenant_id, course_id, enabled,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园启用的课程
('tc00000000000000000001', 'tenant00000000000000000000001', 'course00000000000000000001', 1, NOW(), NOW(), 0),
('tc00000000000000000002', 'tenant00000000000000000000001', 'course00000000000000000002', 1, NOW(), NOW(), 0),
('tc00000000000000000003', 'tenant00000000000000000000001', 'course00000000000000000003', 1, NOW(), NOW(), 0),
-- 希望幼儿园启用的课程
('tc00000000000000000004', 'tenant00000000000000000000002', 'course00000000000000000004', 1, NOW(), NOW(), 0),
-- 星星幼儿园启用的课程
('tc00000000000000000005', 'tenant00000000000000000000003', 'course00000000000000000001', 1, NOW(), NOW(), 0);

-- ============================================
-- 22. 任务目标 (t_task_target)
-- ============================================
DELETE FROM t_task_target WHERE task_id IN ('task000000000000000000001', 'task000000000000000000002', 'task000000000000000000003');

INSERT INTO t_task_target (
    id, task_id, target_type, target_id,
    created_at, deleted
) VALUES
-- 阅读打卡任务 - 面向大（一）班
('tt000000000000000000001', 'task000000000000000000001', 'class', 'class000000000000000000001', NOW(), 0),
-- 绘画作业 - 面向特定学生
('tt000000000000000000002', 'task000000000000000000002', 'student', 'student00000000000000000001', NOW(), 0),
('tt000000000000000000003', 'task000000000000000000002', 'student', 'student00000000000000000002', NOW(), 0),
-- 亲子活动 - 面向大（一）班
('tt000000000000000000004', 'task000000000000000000003', 'class', 'class000000000000000000001', NOW(), 0);

-- ============================================
-- 23. 任务完成记录 (t_task_completion)
-- ============================================
DELETE FROM t_task_completion;

INSERT INTO t_task_completion (
    id, task_id, student_id, status, completed_at, content, attachments, rating, feedback,
    created_at, updated_at, deleted
) VALUES
-- 小明的阅读打卡
('tc000000000000000000001', 'task000000000000000000001', 'student00000000000000000001',
 'completed', DATE_ADD(NOW(), INTERVAL -1 DAY),
 '今天阅读了《猜猜我有多爱你》，小明很喜欢这个故事',
 '["/uploads/task/reading_photo1.jpg"]', 5, '读得很认真，继续加油！',
 NOW(), NOW(), 0),
-- 小红的绘画作业
('tc000000000000000000002', 'task000000000000000000002', 'student00000000000000000002',
 'completed', DATE_ADD(NOW(), INTERVAL -2 DAY),
 '画的是《我爸爸》，爸爸是我心中的超人',
 '["/uploads/task/painting1.jpg"]', 5, '画得很棒，色彩搭配很好！',
 NOW(), NOW(), 0);

-- ============================================
-- 24. 学生评价记录 (t_student_record)
-- ============================================
DELETE FROM t_student_record;

INSERT INTO t_student_record (
    id, lesson_id, student_id, attendance, performance, notes,
    focus, participation, interest, understanding,
    created_at, updated_at, deleted
) VALUES
-- 绘本阅读第 1 课的学生记录
('sr000000000000000000001', 'tlesson0000000000000000001', 'student00000000000000000001',
 'present', '表现积极，踊跃发言', '对故事很感兴趣',
 4, 5, 5, 4,
 NOW(), NOW(), 0),
('sr000000000000000000002', 'tlesson0000000000000000001', 'student00000000000000000002',
 'present', '安静听讲，认真记录', '能理解故事内涵',
 5, 4, 4, 5,
 NOW(), NOW(), 0),
('sr000000000000000000003', 'tlesson0000000000000000001', 'student000000000000000000003',
 'present', '参与度一般', '需要更多引导',
 3, 3, 3, 3,
 NOW(), NOW(), 0);

-- ============================================
-- 25. 课时反馈 (t_lesson_feedback)
-- ============================================
DELETE FROM t_lesson_feedback;

INSERT INTO t_lesson_feedback (
    id, lesson_id, course_id, tenant_id, teacher_id,
    design_quality, participation, goal_achievement, overall_rating,
    step_feedbacks, pros, suggestions, activities_done,
    created_at, updated_at, deleted
) VALUES
('lf000000000000000000001', 'tlesson0000000000000000001', 'course00000000000000000001', 'tenant00000000000000000000001', 'teacher000000000000000000001',
 5, 4, 5, 5,
 '{"step1": "导入环节很好", "step2": "互动充分", "step3": "总结到位"}',
 '课程设计合理，学生参与度高，目标达成好',
 '可以增加更多小组讨论环节',
 '{"activities": ["角色扮演", "分组讨论", "分享感受"]}',
 NOW(), NOW(), 0);

-- ============================================
-- 26. 系统设置 (t_system_setting)
-- ============================================
DELETE FROM t_system_setting WHERE tenant_id IN ('tenant00000000000000000000001', 'tenant00000000000000000000002', 'tenant00000000000000000000003');

INSERT INTO t_system_setting (
    id, tenant_id, setting_key, setting_value, description,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园设置
('setting000000000000000001', 'tenant00000000000000000000001', 'school_logo', '/uploads/logos/sunshine.png', '学校 Logo', NOW(), NOW(), 0),
('setting000000000000000002', 'tenant00000000000000000000001', 'school_motto', '阳光教育，快乐成长', '校训', NOW(), NOW(), 0),
('setting000000000000000003', 'tenant00000000000000000000001', 'contact_info', '北京市朝阳区阳光路 100 号 | 010-12345678', '联系方式', NOW(), NOW(), 0),
('setting000000000000000004', 'tenant00000000000000000000001', 'enrollment_age', '3-6', '招生年龄范围', NOW(), NOW(), 0),
-- 希望幼儿园设置
('setting000000000000000005', 'tenant00000000000000000000002', 'school_logo', '/uploads/logos/hope.png', '学校 Logo', NOW(), NOW(), 0),
('setting000000000000000006', 'tenant00000000000000000000002', 'school_motto', '希望之光，点亮未来', '校训', NOW(), NOW(), 0),
-- 星星幼儿园设置
('setting000000000000000007', 'tenant00000000000000000000003', 'school_logo', '/uploads/logos/star.png', '学校 Logo', NOW(), NOW(), 0),
('setting000000000000000008', 'tenant00000000000000000000003', 'school_motto', '星星之火，可以燎原', '校训', NOW(), NOW(), 0);

-- ============================================
-- 27. 标签 (t_tag)
-- ============================================
DELETE FROM t_tag WHERE tenant_id IN ('tenant00000000000000000000001', 'tenant00000000000000000000002', 'tenant00000000000000000000003');

INSERT INTO t_tag (
    id, tenant_id, name, type, color,
    created_at, updated_at, deleted
) VALUES
-- 阳光幼儿园标签
('tag000000000000000000001', 'tenant00000000000000000000001', '阅读小达人', 'student', '#FF6B6B', NOW(), NOW(), 0),
('tag000000000000000000002', 'tenant00000000000000000000001', '运动健将', 'student', '#4ECDC4', NOW(), NOW(), 0),
('tag000000000000000000003', 'tenant00000000000000000000001', '艺术之星', 'student', '#FFA07A', NOW(), NOW(), 0),
('tag000000000000000000004', 'tenant00000000000000000000001', '语言类', 'course', '#98D8C8', NOW(), NOW(), 0),
('tag000000000000000000005', 'tenant00000000000000000000001', '科学类', 'course', '#45B7D1', NOW(), NOW(), 0),
-- 希望幼儿园标签
('tag000000000000000000006', 'tenant00000000000000000000002', '阅读小达人', 'student', '#FF6B6B', NOW(), NOW(), 0),
('tag000000000000000000007', 'tenant00000000000000000000002', '科学小能手', 'student', '#4ECDC4', NOW(), NOW(), 0),
-- 星星幼儿园标签
('tag000000000000000000008', 'tenant00000000000000000000003', '音乐小天才', 'student', '#F7DC6F', NOW(), NOW(), 0),
('tag000000000000000000009', 'tenant00000000000000000000003', '舞蹈之星', 'student', '#FFA07A', NOW(), NOW(), 0);

-- ============================================
-- 28. 通知数据补充
-- ============================================
INSERT INTO t_notification (
    id, tenant_id, title, content, type, sender_id, sender_role, recipient_type, recipient_id, is_read,
    created_at, deleted
) VALUES
('notify0000000000000000004', 'tenant00000000000000000000001',
 '本周食谱已更新', '请家长查看本周幼儿园食谱，了解孩子饮食情况', 'system',
 NULL, NULL, 'all', NULL, 0,
 NOW(), 0),
('notify0000000000000000005', 'tenant00000000000000000000001',
 '运动会通知', '幼儿园将于下周五举办春季运动会，请家长为孩子准备运动服装', 'system',
 NULL, NULL, 'all', NULL, 0,
 NOW(), 0);

-- ============================================
-- 数据验证查询
-- ============================================
SELECT '========== 测试数据概览 ==========' AS '';

SELECT '主题数据：' AS '';
SELECT id, name, display_name FROM t_theme;

SELECT '租户数据：' AS '';
SELECT id, name, code, status FROM t_tenant;

SELECT '教师用户：' AS '';
SELECT id, tenant_id, username, name, status FROM t_teacher WHERE username NOT LIKE '%kinder%';

SELECT '家长用户：' AS '';
SELECT id, tenant_id, username, name, status FROM t_parent;

SELECT '班级数据：' AS '';
SELECT id, tenant_id, name, grade, status FROM t_clazz;

SELECT '学生数据：' AS '';
SELECT id, tenant_id, name, grade, class_id, status FROM t_student;

SELECT '课程数据：' AS '';
SELECT id, tenant_id, name, code, status FROM t_course;

SELECT '课程包数据：' AS '';
SELECT id, name, course_count, price, status FROM t_course_package;

SELECT '资源库数据：' AS '';
SELECT id, tenant_id, name, type FROM t_resource_library;

SELECT '资源项数据：' AS '';
SELECT id, library_id, name, quantity, available_quantity FROM t_resource_item;

SELECT '租户 - 课程关联：' AS '';
SELECT id, tenant_id, course_id, enabled FROM t_tenant_course;

SELECT '任务数据：' AS '';
SELECT id, tenant_id, title, type, status FROM t_task;

SELECT '========== 数据验证完成 ==========' AS '';