package cn.reghao.tnb.user.app.model.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author reghao
 * @date 2025-10-16 11:17:17
 */
public enum VipMember {
    Month(1, "月度会员", 9.9, 30),
    Season(2, "季度会员", 28.9, 90),
    Year(3, "年度会员", 99.9, 365);

    private final int planId;
    private final String name;
    private final double price;
    private final int duration;
    VipMember(int planId, String name, double price, int duration) {
        this.planId = planId;
        this.name = name;
        this.price = price;
        this.duration = duration;
    }

    private static final Map<Integer, VipMember> vipPlanMap = new HashMap<>();
    static {
        for (VipMember vipMember : VipMember.values()) {
            vipPlanMap.put(vipMember.planId, vipMember);
        }
    }

    public static VipMember getByPlanId(int planId) {
        return vipPlanMap.get(planId);
    }

    public int getPlanId() {
        return planId;
    }

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    public int getDuration() {
        return duration;
    }
}
