package videoenhan

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// MergeVideoModelFace invokes the videoenhan.MergeVideoModelFace API synchronously
func (client *Client) MergeVideoModelFace(request *MergeVideoModelFaceRequest) (response *MergeVideoModelFaceResponse, err error) {
	response = CreateMergeVideoModelFaceResponse()
	err = client.DoAction(request, response)
	return
}

// MergeVideoModelFaceWithChan invokes the videoenhan.MergeVideoModelFace API asynchronously
func (client *Client) MergeVideoModelFaceWithChan(request *MergeVideoModelFaceRequest) (<-chan *MergeVideoModelFaceResponse, <-chan error) {
	responseChan := make(chan *MergeVideoModelFaceResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.MergeVideoModelFace(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// MergeVideoModelFaceWithCallback invokes the videoenhan.MergeVideoModelFace API asynchronously
func (client *Client) MergeVideoModelFaceWithCallback(request *MergeVideoModelFaceRequest, callback func(response *MergeVideoModelFaceResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *MergeVideoModelFaceResponse
		var err error
		defer close(result)
		response, err = client.MergeVideoModelFace(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// MergeVideoModelFaceRequest is the request struct for api MergeVideoModelFace
type MergeVideoModelFaceRequest struct {
	*requests.RpcRequest
	FaceImageURL  string                           `position:"Body" name:"FaceImageURL"`
	MergeInfos    *[]MergeVideoModelFaceMergeInfos `position:"Body" name:"MergeInfos"  type:"Repeated"`
	UserId        string                           `position:"Body" name:"UserId"`
	WatermarkType string                           `position:"Body" name:"WatermarkType"`
	Enhance       requests.Boolean                 `position:"Body" name:"Enhance"`
	TemplateId    string                           `position:"Body" name:"TemplateId"`
	Async         string                           `position:"Body" name:"Async"`
	AddWatermark  requests.Boolean                 `position:"Body" name:"AddWatermark"`
}

// MergeVideoModelFaceMergeInfos is a repeated param struct in MergeVideoModelFaceRequest
type MergeVideoModelFaceMergeInfos struct {
	TemplateFaceURL string `name:"TemplateFaceURL"`
	ImageURL        string `name:"ImageURL"`
	TemplateFaceID  string `name:"TemplateFaceID"`
}

// MergeVideoModelFaceResponse is the response struct for api MergeVideoModelFace
type MergeVideoModelFaceResponse struct {
	*responses.BaseResponse
	RequestId string `json:"RequestId" xml:"RequestId"`
	Code      string `json:"Code" xml:"Code"`
	Message   string `json:"Message" xml:"Message"`
	Data      Data   `json:"Data" xml:"Data"`
}

// CreateMergeVideoModelFaceRequest creates a request to invoke MergeVideoModelFace API
func CreateMergeVideoModelFaceRequest() (request *MergeVideoModelFaceRequest) {
	request = &MergeVideoModelFaceRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("videoenhan", "2020-03-20", "MergeVideoModelFace", "videoenhan", "openAPI")
	request.Method = requests.POST
	return
}

// CreateMergeVideoModelFaceResponse creates a response to parse from MergeVideoModelFace response
func CreateMergeVideoModelFaceResponse() (response *MergeVideoModelFaceResponse) {
	response = &MergeVideoModelFaceResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
