package cooper

import (
	"errors"
	"net/url"
)

//单个灯控下所有线路开灯
func (that *CooperClient) NewUsrK3LightLineTurnOnAllRequest() *UsrK3LightLineTurnOnAllRequest {
	return &UsrK3LightLineTurnOnAllRequest{
		Request: Request{
			Client:     that,
			apiAddress: "/usrK3/lightLineTurnOnAll",
		},
	}
}

//UsrK3LightLineTurnOnAllRequest ...
type UsrK3LightLineTurnOnAllRequest struct {
	Request
}

//Identifier
func (that *UsrK3LightLineTurnOnAllRequest) SetIdentifier(value string) *UsrK3LightLineTurnOnAllRequest {
	that.initParams()
	that.params.Set("identifier", value)
	return that
}

//Params ...
func (that *UsrK3LightLineTurnOnAllRequest) 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 *UsrK3LightLineTurnOnAllRequest) Do() (interface{}, error) {
	//返回data
	_data, _err := that.Client.Post(that.apiAddress, that)
	if _err != nil {
		return nil, _err
	}
	return _data, nil
}
