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 CloseReasonEnum {

    /**
     * 工单重复
     */
    REPEAT(1, "工单重复"),
    /**
     * 无需处理
     */
    NO_NEED_HANDLE(2, "无需处理"),
    /**
     * 其他
     */
    OTHER(3, "其他");

    private final int value;
    private final String desc;

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

}
