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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2024/4/24 15:18
 * @Description: 报修状态枚举类型
 */
@Getter
@AllArgsConstructor
public enum RepairStatusEnum {

    /**
     * 待受理
     */
    TO_ACCEPT(1, "待受理"),
    /**
     * 待派工
     */
    TO_DISPATCH(2, "待派工"),
    /**
     * 待处理
     */
    TO_HANDLE(3, "待处理"),

    /**
     * 处理中
     */
    HANDLING(4, "处理中"),
    /**
     * 待确认
     */
    TO_CONFIRMED(5, "待确认"),
    /**
     * 待回访
     */
    TO_RETURN(6, "待回访"),
    /**
     * 已关闭
     */
    CLOSED(7, "已关闭"),
    /**
     * 已作废
     */
    CANCELED(8, "已作废");

    private final int value;
    private final String desc;

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

}
