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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2024/4/8 15:18
 * @Description: 工单确认结果枚举类型
 */
@Getter
@AllArgsConstructor
public enum ConfirmResultEnum {
    /**
     * 驳回再处理
     */
    REJECTED(1, "驳回再处理"),
    /**
     * 确认已完成并关闭工单
     */
    FINISHED(2, "确认已完成并关闭工单"),
    /**
     * 确认未完成并关闭工单
     */
    NO_FINISHED(3, "确认未完成并关闭工单");

    private final int value;
    private final String desc;

    public static String getDescByCode(Integer value) {
        if (Objects.isNull(value)) {
            return "";
        }
        ConfirmResultEnum[] enumArray = ConfirmResultEnum.values();
        for (ConfirmResultEnum e : enumArray) {
            if (e.getValue() == value) {
                return e.getDesc();
            }
        }
        return "";
    }
}
