package com.fs.project.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fs.project.domain.LevelRule;
import lombok.Data;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Data
public class ProjectStandardVO {
    private Long id;
    private Long companyId;
    private String companyName;
    private String projectType;
    private List<LevelRule> levelConfigList;

    /** ★ 使用兼容老版本 Hutool 的写法 */
    public void setLevelConfig(String levelConfig) {
        if (StrUtil.isNotBlank(levelConfig)) {
            this.levelConfigList = JSONUtil.parseArray(levelConfig).toList(LevelRule.class);
        } else {
            this.levelConfigList = new ArrayList<>();
        }
    }

    private Integer taskLimitCount;
    private String taskLimitPeriod;
    private String delFlag;
    private String searchValue;
    private String createBy;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    private String updateBy;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    private String remark;
    @JsonIgnore
    private String beginTime;
    @JsonIgnore
    private String endTime;
    private Map<String, Object> params;


    /**
     * 项目id
     */
    private Long projectId;

    /**
     * 任务类别
     */
    private String taskTypes;
}