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


import com.aliyun.facebody20191230.models.LiquifyFaceRequest;
import com.aliyun.facebody20191230.models.LiquifyFaceResponse;
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.ALiquifyFaceRequest;
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/LiquifyFace?tab=DEMO&lang=JAVA
 * <p>
 * 智能瘦脸
 * <p>
 * LiquifyFace
 */
@Component
@Slf4j
@CustomPath("liquifyFace")
public class ALiquifyFaceHandle extends AlibabaBaseHandle<ALiquifyFaceRequest, LiquifyFaceResponse> {


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


    @Override
    public String check(ALiquifyFaceRequest aLiquifyFaceRequest) {
        return checkUrlBase64(aLiquifyFaceRequest);
    }


    @Override
    public LiquifyFaceResponse run(ALiquifyFaceRequest aLiquifyFaceRequest, RuntimeOptions runtime) throws Exception {
        LiquifyFaceRequest liquifyFaceRequest =new LiquifyFaceRequest();
        liquifyFaceRequest.setImageURL(aLiquifyFaceRequest.getImageUrl());
        liquifyFaceRequest.setSlimDegree(aLiquifyFaceRequest.getSlimDegree());
        // 复制代码运行请自行打印 API 的返回值
        return client.liquifyFaceWithOptions(liquifyFaceRequest, runtime);
    }
}
