package com.heyu.api.alibaba.handle.facebody;


import com.aliyun.facebody20191230.models.FaceMakeupRequest;
import com.aliyun.facebody20191230.models.FaceMakeupResponse;
import com.aliyun.teautil.models.RuntimeOptions;
import com.heyu.api.data.annotation.CustomPath;
import com.heyu.api.alibaba.AlibabaBaseHandle;
import com.heyu.api.alibaba.request.facebody.AFaceMakeupRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * https://next.api.aliyun.com/api/facebody/2019-12-30/FaceMakeup
 * 人脸美妆
 */
@Component
@Slf4j
@CustomPath("faceMakeup")
public class AFaceMakeupHandle extends AlibabaBaseHandle<AFaceMakeupRequest, FaceMakeupResponse> {

    @Autowired
    private com.aliyun.facebody20191230.Client client;



    @Override
    public String check(AFaceMakeupRequest aFaceMakeupRequest) {
        return checkUrlBase64(aFaceMakeupRequest);
    }


    @Override
    public FaceMakeupResponse run(AFaceMakeupRequest aFaceMakeupRequest, RuntimeOptions runtime) throws Exception {
        FaceMakeupRequest faceMakeupRequest = new FaceMakeupRequest();
        faceMakeupRequest.setImageURL(aFaceMakeupRequest.getImageUrl());
        aFaceMakeupRequest.setMakeupType(aFaceMakeupRequest.getMakeupType());
        aFaceMakeupRequest.setStrength(aFaceMakeupRequest.getStrength());
        aFaceMakeupRequest.setResourceType(aFaceMakeupRequest.getResourceType());
        // 复制代码运行请自行打印 API 的返回值
        return client.faceMakeupWithOptions(faceMakeupRequest, runtime);
    }
}
