package com.ruoyi.xq.enums.consumer;

import com.ruoyi.xq.enums.user.AccountChangeCodeEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum ConsumerTypeEnum {
    VIP(1,"VIP"),
    ;
    private final Integer code;
    private final String text;

    ConsumerTypeEnum(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public static ConsumerTypeEnum getByCode(Integer type) {
        return Arrays.stream(ConsumerTypeEnum.values()).filter(i -> i.getCode().equals(type)).findFirst().orElse(null);
    }

    public static AccountChangeCodeEnum getOneInviteChange(ConsumerTypeEnum type){
        if(type == ConsumerTypeEnum.VIP){
            return AccountChangeCodeEnum.VIP_INVITE;
        }
        return null;
    }
}
