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

    //客户类别(1:房源业主 2:业主成员 3:房源租客 4:租客成员 5:开发商 6:服务商 7:其他)
    /**
     * 房源业主
     */
    HOUSE_OWNER(1, "房源业主"),
    /**
     * 业主成员
     */
    OWNER_MEMBER(2, "业主成员"),
    /**
     * 房源租客
     */
    HOUSE_TENANT(3, "房源租客"),
    /**
     * 租客成员
     */
    TENANT_MEMBER(4, "租客成员"),
    /**
     * 开放商
     */
    OPENER(5, "开放商"),
    /**
     * 服务商
     */
    SERVICE(6, "服务商"),
    /**
     * 其他
     */
    OTHER(7, "其他");

    private final int value;
    private final String desc;

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

}
