package api.common.pojo.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum MultiSimulationTaskStatusEnum {

    INIT_STATUS(0, "未开始"),
    RUN_STATUS(1, "运行中"),
    // 手动停止
    PERSON_CANCEL_STATUS(2, "手动终止"),
    COMPLETED_STATUS(3, "已完成"),
    AUTO_TERMINATED_STATUS(4, "自动终止"),
    NEED_ANALYSIS_STATUS(5, "待分析"),
    TERMINATED_STATUS(6, "terminated");

    private Integer projectStatus;

    private String projectStatusValue;

    MultiSimulationTaskStatusEnum(Integer projectStatus, String projectStatusValue) {
        this.projectStatus = projectStatus;
        this.projectStatusValue = projectStatusValue;
    }

    public static MultiSimulationTaskStatusEnum matchStatusEnumByStatus(Integer status) {
        if (Objects.isNull(status)) {
            return null;
        }
        for (MultiSimulationTaskStatusEnum enums : MultiSimulationTaskStatusEnum.values()) {
            if (enums.getProjectStatus().equals(status)){
                return enums;
            }
        }
        return null;
    }
}
