package com.cool.store.enums.point;

import java.util.Objects;

/**
 * @author zhangchenbiao
 * @FileName: ConsumerAbilityEnum
 * @Description:消费能力
 * @date 2024-03-26 16:08
 */
public enum ConsumerAbilityEnum {

    //1.高端 2.中高端 3.中端 4.低端
    CONSUMER_ABILITY_1(1, "高端", 10),
    CONSUMER_ABILITY_2(2, "中高端", 8),
    CONSUMER_ABILITY_3(3, "中端", 6),
    CONSUMER_ABILITY_4(4, "低端", 4),
    ;

    private Integer code;

    private String desc;

    private Integer score;

    ConsumerAbilityEnum(Integer code, String desc, Integer score) {
        this.code = code;
        this.desc = desc;
        this.score = score;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public Integer getScore() {
        return score;
    }

    public static ConsumerAbilityEnum getByCode(Integer code) {
        if(Objects.isNull(code)){
            return null;
        }
        for (ConsumerAbilityEnum consumerAbilityEnum : ConsumerAbilityEnum.values()) {
            if (consumerAbilityEnum.getCode().equals(code)) {
                return consumerAbilityEnum;
            }
        }
        return null;
    }

}
