package nt

import (
	pb "../protos"
	"../utils"
)

func GetVIPByBets(bets int64) (int32, *pb.VipConfItem, error) {
	conf_size := len(DynConf.Vip)
	if conf_size <= 0 {
		return 1, nil, utils.ErrEmptySlice
	}

	var level int32 = 0
	pv := DynConf.Vip[0]
	for i, v := range DynConf.Vip {
		if bets >= v.Lowest*100 {
			level = int32(i)
			pv = v
		} else {
			break
		}
		// automatically break
	}

	return level + 1, pv, nil
}
