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

    /**
     * 待开始
     */
    TO_BEGIN(1, "待开始"),
    /**
     * 处理中
     */
    HANDLING(2, "处理中"),
    /**
     * 待确认
     */
    TO_CONFIRM(3, "待确认"),
    /**
     * 已关闭
     */
    CLOSED(4, "已关闭");

    private final int value;
    private final String desc;

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

}
