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 IdTypeEnum {
    //证件类型(1:营业执照 2:身份证)
    /**
     * 营业执照
     */
    BUSINESS_LICENSE(1, "营业执照"),
    /**
     * 身份证
     */
    ID_CARD(2, "身份证");

    private final int value;
    private final String desc;

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