package cooper

import (
	"errors"
	"net/url"
)

//更新设备绑定状态
func (that *CooperClient) NewFrontallinoneUpdateBindStatusRequest() *FrontallinoneUpdateBindStatusRequest {
	return &FrontallinoneUpdateBindStatusRequest{
		Request: Request{
			Client:     that,
			apiAddress: "/frontAllInOne/updateBindStatus",
		},
	}
}

//FrontallinoneUpdateBindStatusRequest ...
type FrontallinoneUpdateBindStatusRequest struct {
	Request
}

//设备ID
func (that *FrontallinoneUpdateBindStatusRequest) SetDevId(value string) *FrontallinoneUpdateBindStatusRequest {
	that.initParams()
	that.params.Set("dev_id", value)
	return that
}

//绑定状态
func (that *FrontallinoneUpdateBindStatusRequest) SetBindStatus(value int64) *FrontallinoneUpdateBindStatusRequest {
	that.initParams()
	that.params.Set("bind_status", ToString(value))
	return that
}

//Params ...
func (that *FrontallinoneUpdateBindStatusRequest) Params() (url.Values, error) {
	that.initParams()
	_params := that.params
	if that.publicParamsSlice != nil {
		for _, _v := range that.publicParamsSlice {
			if _params.Get(_v) == "" {
				return nil, errors.New(that.apiAddress + "缺少参数:" + _v)
			}
		}
	}
	return _params, nil
}

//Do ...
func (that *FrontallinoneUpdateBindStatusRequest) Do() (interface{}, error) {
	//返回data
	_data, _err := that.Client.Post(that.apiAddress, that)
	if _err != nil {
		return nil, _err
	}
	return _data, nil
}
