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

import com.aliyun.facebody20191230.models.FaceBeautyRequest;
import com.aliyun.facebody20191230.models.FaceBeautyResponse;
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.AFaceBeautyRequest;
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/FaceBeauty
 * 人脸美颜
 */
@Component
@Slf4j
@CustomPath("faceBeauty")
public class AFaceBeautyHandle extends AlibabaBaseHandle<AFaceBeautyRequest, FaceBeautyResponse> {

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


    @Override
    public String check(AFaceBeautyRequest aFaceBeautyRequest) {
        return checkUrlBase64(aFaceBeautyRequest);
    }



    @Override
    public FaceBeautyResponse run(AFaceBeautyRequest aFaceBeautyRequest, RuntimeOptions runtime) throws Exception {
        FaceBeautyRequest faceBeautyRequest = new FaceBeautyRequest();
        faceBeautyRequest.setImageURL(aFaceBeautyRequest.getImageUrl());
        faceBeautyRequest.setSharp(aFaceBeautyRequest.getSharp());
        faceBeautyRequest.setSmooth(aFaceBeautyRequest.getSmooth());
        faceBeautyRequest.setWhite(aFaceBeautyRequest.getWhite());

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