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


import com.aliyun.facebody20191230.models.EnhanceFaceRequest;
import com.aliyun.facebody20191230.models.EnhanceFaceResponse;
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.AEnhanceFaceRequest;
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/EnhanceFace
 * <p>
 * 人脸修复增强
 */
@Component
@Slf4j
@CustomPath("enhanceFace")
public class AEnhanceFaceHandle extends AlibabaBaseHandle<AEnhanceFaceRequest, EnhanceFaceResponse> {

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

    @Override
    public String check(AEnhanceFaceRequest aEnhanceFaceRequest) {
        return checkUrlBase64(aEnhanceFaceRequest);
    }


    @Override
    public EnhanceFaceResponse run(AEnhanceFaceRequest aEnhanceFaceRequest, RuntimeOptions runtime) throws Exception {

        EnhanceFaceRequest enhanceFaceRequest = new EnhanceFaceRequest();
        enhanceFaceRequest.setImageURL(aEnhanceFaceRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.enhanceFaceWithOptions(enhanceFaceRequest, runtime);
    }

}
