package com.ruoyi.xq.enums.vip;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum VipTimeEnum {
    MONTH(1,"月卡",1),
    QUARTER(2,"季卡",3),
    YEAR(3,"年卡",12),
    ;
    private final Integer code;
    private final String text;
    private final Integer month;

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

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