package com.lesingle.modules.biz.review.dto;

import com.lesingle.modules.biz.review.entity.BizPresetComment;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

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

/**
 * 预设评语展示对象，与「预设评语管理」列表列一致：序号（前端本地）、评语内容、使用次数、操作依赖 id。
 */
@Data
@Schema(description = "预设评语")
public class PresetCommentVo {

    @Schema(description = "主键")
    private Long id;

    @Schema(description = "活动ID，可为空")
    private Long contestId;

    @Schema(description = "评委用户ID")
    private Long judgeId;

    @Schema(description = "评语内容")
    private String content;

    @Schema(description = "关联分数")
    private BigDecimal score;

    @Schema(description = "排序")
    private Integer sortOrder;

    @Schema(description = "使用次数")
    private Integer useCount;

    @Schema(description = "有效状态：1-有效")
    private Integer validState;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "修改时间")
    private LocalDateTime modifyTime;

    public static PresetCommentVo fromEntity(BizPresetComment entity) {
        if (entity == null) {
            return null;
        }
        PresetCommentVo vo = new PresetCommentVo();
        vo.setId(entity.getId());
        vo.setContestId(entity.getContestId());
        vo.setJudgeId(entity.getJudgeId());
        vo.setContent(entity.getContent());
        vo.setScore(entity.getScore());
        vo.setSortOrder(entity.getSortOrder());
        vo.setUseCount(entity.getUseCount());
        vo.setValidState(entity.getValidState());
        vo.setCreateTime(entity.getCreateTime());
        vo.setModifyTime(entity.getModifyTime());
        return vo;
    }
}
