package cooper

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

//NewFaceUserAddRequest ...
func (that *CooperClient) NewFaceUserGetRequest() *FaceUserGetRequest {
	return &FaceUserGetRequest{
		Client:     that,
		apiAddress: "/baiduFace/userGet",
	}
}

//FaceUserAddRequest ...
type FaceUserGetRequest struct {
	Client     *CooperClient
	apiAddress string
	PersonId   string `json:"person_id"`
	GroupId    string `json:"group_id"` //用户分组id
}

//SetData...
func (that *FaceUserGetRequest) SetGroupID(groupID int64) *FaceUserGetRequest {
	that.GroupId = utils.ToString(groupID)
	return that
}

func (that *FaceUserGetRequest) SetPersonId(personId string) *FaceUserGetRequest {
	that.PersonId = personId
	return that
}

//Params ...
func (that *FaceUserGetRequest) Params() (url.Values, error) {
	var m = make(url.Values)
	m.Set("group_id", that.GroupId)
	m.Set("person_id", that.PersonId)
	return m, nil
}

//Do ...
func (that *FaceUserGetRequest) Do() (string, error) {
	//
	_data, _err := that.Client.Post(that.apiAddress, that)
	if _err != nil {
		return "", _err
	}
	fmt.Println(_data, "=======", utils.TypeOf(_data))
	//
	return utils.ToString(_data, true), nil
}
