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


import com.aliyun.facebody20191230.models.FaceTidyupRequest;
import com.aliyun.facebody20191230.models.FaceTidyupResponse;
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.AFaceTidyupRequest;
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/FaceTidyup?tab=DEMO&lang=JAVA
 * 人脸美型
 */
@Component
@Slf4j
@CustomPath("faceTidyup")
public class AFaceTidyupHandle extends AlibabaBaseHandle<AFaceTidyupRequest, FaceTidyupResponse> {

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

    @Override
    public String check(AFaceTidyupRequest aFaceTidyupRequest) {
        return checkUrlBase64(aFaceTidyupRequest);
    }



    @Override
    public FaceTidyupResponse run(AFaceTidyupRequest aFaceTidyupRequest, RuntimeOptions runtime) throws Exception {

        FaceTidyupRequest faceTidyupRequest = new FaceTidyupRequest();
        faceTidyupRequest.setImageURL(aFaceTidyupRequest.getImageUrl());
        faceTidyupRequest.setStrength(aFaceTidyupRequest.getStrength());
        faceTidyupRequest.setShapeType(aFaceTidyupRequest.getShapeType());



        // 复制代码运行请自行打印 API 的返回值
        return client.faceTidyupWithOptions(faceTidyupRequest, runtime);
    }
}
