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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2024/4/29 15:18
 * @Description: 评价等级枚举类型
 */
@Getter
@AllArgsConstructor
public enum EvaluateLevelEnum {
    /**
     * 好评
     */
    POSITIVE(1, "好评"),
    /**
     * 中评
     */
    MID(2, "中评"),
    /**
     * 差评
     */
    NEGATIVE(3, "差评");

    private final int value;
    private final String desc;

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

}
