package ppos

import (
	"PPOSUtils/utils"
)

//NewJwtGym 令牌：场馆营业系统
func NewJwtGym() *wtGym {
	return &wtGym{}
}

type wtGym struct {
	JwtCompany
}

func (that *wtGym) init() {
	if that.paramsMp == nil {
		that.JwtCompany.init()
		//that.paramsSlice = append(that.paramsSlice, "business_id")
	}
}

//func (that *wtGym) SetBusinessID(businessID int64) {
//	that.init()
//	that.paramsMp.Set("business_id", businessID)
//}

//生成应用令牌
func (that *wtGym) CreateJwt(params ...utils.Mp) (string, error) {
	//
	that.init()
	_jwtString, _err := that.JwtCompany.CreateJwt(params...)
	if _err != nil {
		return "", _err
	}
	return _jwtString, nil
}

func (that *wtGym) ParseParams() (utils.Mp, error) {
	//
	that.init()
	if _, _err := that.JwtCompany.ParseParams(); _err != nil {
		return nil, _err
	}
	return that.paramsMp, nil
}
