/**
 * 核心服务接口sdk（golang版）
 *
 * @desc 啪啪运动 核心服务接口sdk
 * ---------------------------------------------------------------------
 * @author		logan <lgq092@163.com>
 * @date		2020-01-06
 * @copyright	core-utils
 * ---------------------------------------------------------------------
 */

package pposRequest

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

//NewCfgInstructionEdit 增加人脸采集协议信息
func (that *PPOSClient) NewCfgInstructionEdit() *CfgInstructionEditRequest {
	return &CfgInstructionEditRequest{
		Request: Request{
			Client:     that,
			apiAddress: "/cfg/instruction/edit",
		},
	}
}

//CfgInstructionEditRequest 人脸采集协议信息
type CfgInstructionEditRequest struct {
	Request
	Content        string `json:"content"`         //内容
	InstructionId  int64  `json:"instruction_id"`  //
	InstructionPid int64  `json:"instruction_pid"` //
	IsEnable       int64  `json:"is_enable"`       //
	Title          string `json:"title"`           //
	Sort           int64  `json:"sort"`            //
	RootId         int64  `json:"root_id"`         //
	WxBounced      int64  `json:"wx_bounced"`      //
}

func (that *CfgInstructionEditRequest) SetContent(Content string) *CfgInstructionEditRequest {
	that.Content = Content
	return that
}
func (that *CfgInstructionEditRequest) SetInstructionId(InstructionId int64) *CfgInstructionEditRequest {
	that.InstructionId = InstructionId
	return that
}
func (that *CfgInstructionEditRequest) SetInstructionPid(InstructionPid int64) *CfgInstructionEditRequest {
	that.InstructionPid = InstructionPid
	return that
}
func (that *CfgInstructionEditRequest) SetIsEnable(IsEnable int64) *CfgInstructionEditRequest {
	that.IsEnable = IsEnable
	return that
}
func (that *CfgInstructionEditRequest) SetTitle(Title string) *CfgInstructionEditRequest {
	that.Title = Title
	return that
}
func (that *CfgInstructionEditRequest) SetSort(Sort int64) *CfgInstructionEditRequest {
	that.Sort = Sort
	return that
}
func (that *CfgInstructionEditRequest) SetRootId(RootId int64) *CfgInstructionEditRequest {
	that.RootId = RootId
	return that
}
func (that *CfgInstructionEditRequest) SetWxBounced(WxBounced int64) *CfgInstructionEditRequest {
	that.WxBounced = WxBounced
	return that
}

//Params ...
func (that *CfgInstructionEditRequest) Params() (url.Values, error) {
	that.initParams()
	m := that.params
	m.Set("content", utils.ToString(that.Content))
	m.Set("instruction_id", utils.ToString(that.InstructionId))
	m.Set("instruction_pid", utils.ToString(that.InstructionPid))
	m.Set("is_enable", utils.ToString(that.IsEnable))
	m.Set("title", utils.ToString(that.Title))
	m.Set("sort", utils.ToString(that.Sort))
	m.Set("root_id", utils.ToString(that.RootId))
	m.Set("wx_bounced", utils.ToString(that.WxBounced))
	return m, nil
}

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