package net.northking.cctp.executePlan.dto.planTask;

import cn.hutool.core.collection.CollUtil;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Data
public class ScriptStatusStatistic {

    // 脚本主键
    private String scriptId;

    // 脚本下所有任务的状态
    private String statusString;

    // 批次下脚本的状态
    private String status;

    // 脚本下的任务数量
    private int total;

    private Set<String> statusSet;

    public Set<String> getStatusSet() {
        if (this.statusSet != null) {
            return this.statusSet;
        }
        if (StringUtils.isNotBlank(this.statusString)) {
            String[] split = this.statusString.split(",");
            statusSet = CollUtil.newHashSet(split);
            return statusSet;
        }
        statusSet = new HashSet<>();
        return statusSet;
    }
}
