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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2024/01/09 15:18
 * @Description: 住户状态枚举类型
 */
@Getter
@AllArgsConstructor
public enum ResidentStatusEnum {

    /**
     * 正常
     */
    NORMAL(1, "正常"),
    /**
     * 无效
     */
    INVALID(3, "无效");

    private final int value;
    private final String desc;

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

}
