package com.reading.platform.entity;

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

import java.time.LocalDateTime;

/**
 * 课程课时实体（课程内的章节/部分）
 */
@Data
@TableName("t_course_lesson")
@Schema(description = "课程课时")
public class CourseLesson {

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

    @Schema(description = "课程 ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private String courseId;

    @Schema(description = "课时标题", example = "第一课时：认识绘本", requiredMode = Schema.RequiredMode.REQUIRED)
    private String title;

    @Schema(description = "课时描述")
    private String description;

    @Schema(description = "课时内容")
    private String content;

    @Schema(description = "排序顺序", example = "1")
    private Integer sortOrder;

    @Schema(description = "课时顺序号", example = "1")
    private Integer lessonOrder;

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

    @Schema(description = "视频 URL")
    private String videoUrl;

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

    @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;
}
