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

    //入驻状态(1:未入驻 2:入驻中 3:已过期)
    /**
     * 未入驻
     */
    NO_ENTRY(1, "未入驻"),
    /**
     * 入驻中
     */
    ENTRY(1, "入驻中"),
    /**
     * 已过期
     */
    EXPIRED(2, "已过期");

    private final int value;
    private final String desc;

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

}
