package pposRequest

import (
	"PPOSUtils/utils"
	"net/url"
)

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

// XiaoLiYunNfcCheckIn 请求参数...
type XiaoLiYunNfcCheckInRequest struct {
	Request
	NfcCardNo      int64 `json:"nfc_card_no"` //Nfc 卡内码编号(必填)
	ClubId      string  `json:"club_id"` //标识场馆的 ID (选填)
	DeviceName      string `json:"device_name"` //设备名称(选填)
}

//SetNfcCardNo ...
func (that *XiaoLiYunNfcCheckInRequest) SetNfcCardNo(value int64) *XiaoLiYunNfcCheckInRequest {
	that.NfcCardNo = value
	return that
}

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

//SetDeviceName ...
func (that *XiaoLiYunNfcCheckInRequest) SetDeviceName(value string) *XiaoLiYunNfcCheckInRequest {
	that.DeviceName = value
	return that
}

//Params ...
func (that *XiaoLiYunNfcCheckInRequest) Params() (url.Values, error) {
	var m = make(url.Values)
	m.Set("nfc_card_no", utils.ToString(that.NfcCardNo))
	if that.ClubId != "" {
		m.Set("club_id", that.ClubId)
	}
	m.Set("device_name", that.DeviceName)
	return m, nil
}

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