package com.reading.platform.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 课程实体
 * 课程包实体，包含完整的课程管理字段
 */
@Data
@TableName("t_course")
@Schema(description = "课程信息")
public class Course {

    @Schema(description = "课程 ID", accessMode = Schema.AccessMode.READ_ONLY)
    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    @Schema(description = "租户 ID", accessMode = Schema.AccessMode.READ_ONLY)
    private String tenantId;

    @Schema(description = "课程名称", example = "绘本阅读入门", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @Schema(description = "课程编码", example = "READ001")
    private String code;

    @Schema(description = "课程描述", example = "适合大班幼儿的绘本阅读课程")
    private String description;

    @Schema(description = "封面图片 URL")
    private String coverUrl;

    @Schema(description = "分类", example = "language")
    private String category;

    @Schema(description = "适用年龄段", example = "5-6 岁")
    private String ageRange;

    @Schema(description = "难度等级", example = "beginner")
    private String difficultyLevel;

    @Schema(description = "课程时长（分钟）", example = "30")
    private Integer durationMinutes;

    @Schema(description = "课程目标")
    private String objectives;

    @Schema(description = "状态", example = "published")
    private String status;

    @Schema(description = "是否系统课程 0-否 1-是", example = "0")
    private Integer isSystem;

    // ============================================
    // 课程包重构字段 (2026-02-28)
    // ============================================

    // 核心内容
    @Schema(description = "核心内容")
    private String coreContent;

    // 课程介绍（8 个字段）
    @Schema(description = "课程介绍摘要")
    private String introSummary;

    @Schema(description = "课程亮点")
    private String introHighlights;

    @Schema(description = "课程目标")
    private String introGoals;

    @Schema(description = "课程进度安排")
    private String introSchedule;

    @Schema(description = "课程重点")
    private String introKeyPoints;

    @Schema(description = "教学方法")
    private String introMethods;

    @Schema(description = "评估方式")
    private String introEvaluation;

    @Schema(description = "注意事项")
    private String introNotes;

    // 课表参考数据（JSON）
    @Schema(description = "课表参考数据 JSON")
    private String scheduleRefData;

    // 环境创设（步骤 7）
    @Schema(description = "环境创设方案")
    private String environmentConstruction;

    // 主题与绘本关系
    @Schema(description = "主题 ID")
    private String themeId;

    @Schema(description = "绘本名称")
    private String pictureBookName;

    // 封面图片
    @Schema(description = "封面图片路径")
    private String coverImagePath;

    // 数字资源（JSON 数组）
    @Schema(description = "电子书资源路径 JSON")
    private String ebookPaths;

    @Schema(description = "音频资源路径 JSON")
    private String audioPaths;

    @Schema(description = "视频资源路径 JSON")
    private String videoPaths;

    @Schema(description = "其他资源路径 JSON")
    private String otherResources;

    // 教学材料
    @Schema(description = "PPT 课件路径")
    private String pptPath;

    @Schema(description = "PPT 课件名称")
    private String pptName;

    @Schema(description = "海报图片路径 JSON")
    private String posterPaths;

    @Schema(description = "教学工具")
    private String tools;

    @Schema(description = "学生材料")
    private String studentMaterials;

    // 教案、活动、评估（JSON）
    @Schema(description = "教案数据 JSON")
    private String lessonPlanData;

    @Schema(description = "活动数据 JSON")
    private String activitiesData;

    @Schema(description = "评估数据 JSON")
    private String assessmentData;

    // 年级与领域标签（JSON 数组）
    @Schema(description = "年级标签 JSON")
    private String gradeTags;

    @Schema(description = "领域标签 JSON")
    private String domainTags;

    // 集体课标志
    @Schema(description = "是否有集体课 0-否 1-是")
    private Integer hasCollectiveLesson;

    // 版本与审核字段
    @Schema(description = "版本号")
    private String version;

    @Schema(description = "父课程 ID")
    private String parentId;

    @Schema(description = "是否最新版本 0-否 1-是")
    private Integer isLatest;

    @Schema(description = "提交时间", accessMode = Schema.AccessMode.READ_ONLY)
    private LocalDateTime submittedAt;

    @Schema(description = "提交人 ID", accessMode = Schema.AccessMode.READ_ONLY)
    private Long submittedBy;

    @Schema(description = "审核时间", accessMode = Schema.AccessMode.READ_ONLY)
    private LocalDateTime reviewedAt;

    @Schema(description = "审核人 ID", accessMode = Schema.AccessMode.READ_ONLY)
    private Long reviewedBy;

    @Schema(description = "审核意见")
    private String reviewComment;

    @Schema(description = "审核清单 JSON")
    private String reviewChecklist;

    @Schema(description = "发布时间", accessMode = Schema.AccessMode.READ_ONLY)
    private LocalDateTime publishedAt;

    // 使用统计
    @Schema(description = "使用次数", example = "100")
    private Integer usageCount;

    @Schema(description = "教师使用人数", example = "20")
    private Integer teacherCount;

    @Schema(description = "平均评分", example = "4.5")
    private BigDecimal avgRating;

    @Schema(description = "创建人用户名", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    @Schema(description = "更新人用户名", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    @Schema(description = "创建时间", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @Schema(description = "更新时间", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    @Schema(description = "是否删除 0-未删除 1-已删除", accessMode = Schema.AccessMode.READ_ONLY)
    @TableLogic
    private Integer deleted;

}
