package com.reading.platform.entity;

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

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 任务实体
 */
@Data
@TableName("t_task")
@Schema(description = "任务信息")
public class Task {

    @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 = "绘本阅读打卡")
    private String title;

    @Schema(description = "任务描述")
    private String description;

    @Schema(description = "任务类型", example = "reading")
    private String type;

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

    @Schema(description = "创建者 ID", accessMode = Schema.AccessMode.READ_ONLY)
    private String creatorId;

    @Schema(description = "创建者角色", example = "teacher", accessMode = Schema.AccessMode.READ_ONLY)
    private String creatorRole;

    @Schema(description = "开始日期", example = "2024-01-01")
    private LocalDate startDate;

    @Schema(description = "截止日期", example = "2024-01-31")
    private LocalDate dueDate;

    @Schema(description = "任务状态", example = "active")
    private String status;

    @Schema(description = "附件 JSON")
    private String attachments;

    @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 = "逻辑删除标志", accessMode = Schema.AccessMode.READ_ONLY)
    @TableLogic
    private Integer deleted;

}
