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

    //客户类型(1:机构 2:个人)
    /**
     * 机构
     */
    ORGAN(1, "机构"),
    /**
     * 个人
     */
    PERSON(2, "个人");

    private final int value;
    private final String desc;

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

}
