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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2023/11/29 15:18
 * @Description: 登记状态枚举类型
 */
@Getter
@AllArgsConstructor
public enum RegisterStatusEnum {

    //登记状态(1:未登记 2:已登记 3:已失效)
    /**
     * 未登记
     */
    NO(1, "未登记"),
    /**
     * 已登记
     */
    REGISTERED(2, "已登记"),
    /**
     * 已失效
     */
    EXPIRED(3, "已失效");

    private final int value;
    private final String desc;

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

}
