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;
import java.util.List;

/**
 * 课程包实体
 * 课程的集合，如"小班语言课程包"
 */
@Data
@TableName("t_course_package")
@Schema(description = "课程包")
public class CoursePackage {

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

    // === 基础信息 ===
    @Schema(description = "课程包名称", example = "小班语言课程包", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @Schema(description = "课程包描述", example = "适合小班幼儿的语言领域课程包")
    private String description;

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

    @Schema(description = "课程数量", example = "10")
    private Integer courseCount;

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

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

    // === 关联关系（一对多） ===
    @TableField(exist = false)
    private List<CoursePackageCourse> packageCourses;

    // === 关联关系（多对多，通过套餐 - 课程包关联表） ===
    @TableField(exist = false)
    private List<ProductBundleCoursePackage> bundleCoursePackages;
}
