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_resource")
@Schema(description = "课程资源")
public class CourseResource {

    @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 = "绘本 PPT 课件", requiredMode = Schema.RequiredMode.REQUIRED)
    private String title;

    @Schema(description = "资源类型", example = "ppt", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"ppt", "pdf", "video", "audio", "image", "document"})
    private String type;

    @Schema(description = "资源 URL")
    private String url;

    @Schema(description = "文件路径")
    private String filePath;

    @Schema(description = "文件大小（字节）", example = "1048576")
    private Long fileSize;

    @Schema(description = "时长（秒）", example = "300")
    private Integer duration;

    @Schema(description = "资源描述")
    private String description;

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

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

}
