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

    /**
     * 问题已解决
     */
    solved(1, "问题已解决"),
    /**
     * 问题未解决
     */
    no_solved(2, "问题未解决"),
    /**
     * 无需处理
     */
    IGNORE(3, "无需处理");

    private final int value;
    private final String desc;

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