package com.yuchen.saas.park.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 肖祥
 * @date 2022/10/20 17:11
 * 任务完成情况:1、按时完成 2、超时完成3、异常终止4、超时未完成
 */
@Getter
@AllArgsConstructor
public enum TaskCompleteSituEnum {
    NORMAL_COMPLETE(1, "按时完成"),
    OVERTIME_TO_COMPLETE(2, "超时完成"),
    EXCEPTION_STOP(3, "异常终止"),
    TIMEOUT_NOT_COMPLETED(4, "超时未完成");

    private Integer code;

    private String description;

    public static String getDescByCode(Integer code) {
        TaskCompleteSituEnum[] maskEnumArray = TaskCompleteSituEnum.values();
        for (TaskCompleteSituEnum maskEnum : maskEnumArray) {
            if (maskEnum.getCode().equals(code)) {
                return maskEnum.getDescription();
            }
        }
        return null;
    }
}
