package pposRequest

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

//new...
func (that *PPOSClient) NewLockerUseNotice() *LockerUseNoticeRequest {
	return &LockerUseNoticeRequest{
		Request: Request{
			Client:     that,
			apiAddress: "/enterAdmin/boxcentral/useNotice",
		},
	}
}

// UseRequest 请求参数..
type LockerUseNoticeRequest struct {
	Request
	UserKey     string `json:"user_key"`     //用户唯一号
	Mac         string `json:"mac"`          //箱柜屏 mac 地址
	BmId        int64  `json:"bm_id"`        //中控 id
	BmName      string `json:"bm_name"`      //中控名
	BoxId       int64  `json:"box_id"`       //箱子 id
	BoxName     string `json:"box_name"`     //箱号
	BoxType     int64  `json:"box_type"`     //箱柜类型
	Status      int64  `json:"status"`       //1 开始 0 结束(释放方式) 2 结束(归还方式) 3 开柜
	Pwd         string `json:"pwd"`          //离线开箱密码[结束使用，开柜无该字段]
	OperateTime string `json:"operate_time"` //操作时间
	apiAddress  string
}

//SetUserKey...
func (that *LockerUseNoticeRequest) SetUserKey(value string) *LockerUseNoticeRequest {
	that.UserKey = value
	return that
}

//SetMac...
func (that *LockerUseNoticeRequest) SetMac(value string) *LockerUseNoticeRequest {
	that.Mac = value
	return that
}

//SetBoxId..
func (that *LockerUseNoticeRequest) SetBoxId(value int64) *LockerUseNoticeRequest {
	that.BoxId = value
	return that
}
func (that *LockerUseNoticeRequest) SetBoxName(value string) *LockerUseNoticeRequest {
	that.BoxName = value
	return that
}

//SetBmId...
func (that *LockerUseNoticeRequest) SetBmId(value int64) *LockerUseNoticeRequest {
	that.BmId = value
	return that
}

//SetBmName..
func (that *LockerUseNoticeRequest) SetBmName(value string) *LockerUseNoticeRequest {
	that.BmName = value
	return that
}

//SetBoxType..
func (that *LockerUseNoticeRequest) SetBoxType(value int64) *LockerUseNoticeRequest {
	that.BoxType = value
	return that
}

//SetStatus..
func (that *LockerUseNoticeRequest) SetStatus(value int64) *LockerUseNoticeRequest {
	that.Status = value
	return that
}

//SetPwd..
func (that *LockerUseNoticeRequest) SetPwd(value string) *LockerUseNoticeRequest {
	that.Pwd = value
	return that
}

//SetOperateTime..
func (that *LockerUseNoticeRequest) SetOperateTime(value string) *LockerUseNoticeRequest {
	that.OperateTime = value
	return that
}

//Params ...
func (that *LockerUseNoticeRequest) Params() (url.Values, error) {
	var m = make(url.Values)
	m.Set("userKey", that.UserKey)
	m.Set("mac", that.Mac)
	m.Set("bmId", utils.ToString(that.BmId))
	m.Set("bmName", that.BmName)
	m.Set("boxId", utils.ToString(that.BoxId))
	m.Set("boxName", that.BoxName)
	m.Set("boxType", utils.ToString(that.BoxType))
	m.Set("status", utils.ToString(that.Status))
	m.Set("pwd", that.Pwd)
	m.Set("operateTime", that.OperateTime)
	return m, nil
}

//Do ...
func (that *LockerUseNoticeRequest) Do() (bool, error) {
	_, _err := that.Client.GetData(that.apiAddress, that)
	if _err != nil {
		return false, _err
	}
	return true, nil
}
