package pposRequest

import (
	"net/url"
)

func (that *PPOSClient) NewXiaoLiYunGetMemberCard() *XiaoLiYunGetMemberCardRequest {
	return &XiaoLiYunGetMemberCardRequest{
		Request: Request{
			Client:     that,
			apiAddress: "/ticket/water/checkAuth",
		},
	}
}

// XiaoLiYunGetMemberCard 请求参数...
type XiaoLiYunGetMemberCardRequest struct {
	Request
	CardNo      string `json:"card_no"` //卡号(ic 卡内码,读卡器读出来的卡号)。如无实体卡号,传入手机号码或 用户 ID 作为卡号(必填)
	ClubId      string  `json:"club_id"` //场馆的 ID(选填)
}

//SetCardNo ...
func (that *XiaoLiYunGetMemberCardRequest) SetCardNo(value string) *XiaoLiYunGetMemberCardRequest {
	that.CardNo = value
	return that
}

//SetClubId ...
func (that *XiaoLiYunGetMemberCardRequest) SetClubId(value string) *XiaoLiYunGetMemberCardRequest {
	that.ClubId = value
	return that
}

//Params ...
func (that *XiaoLiYunGetMemberCardRequest) Params() (url.Values, error) {
	var m = make(url.Values)
	m.Set("card_no", that.CardNo)
	if that.ClubId != "" {
		m.Set("club_id", that.ClubId)
	}
	return m, nil
}

//Do ...
func (that *XiaoLiYunGetMemberCardRequest) Do() (interface{}, error) {
	_responData, _err := that.Client.GetData(that.apiAddress, that)
	if _err != nil {
		return nil, _err
	}
	return _responData, nil
}
