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


import com.aliyun.imageenhan20190930.models.AssessSharpnessRequest;
import com.aliyun.imageenhan20190930.models.AssessSharpnessResponse;
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.imageenhan.AAssessSharpnessRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/imageenhan/2019-09-30/AssessSharpness
 * <p>
 * 图像清晰度评分 AssessSharpness
 */

@Component
@Slf4j
@CustomPath("assessSharpness")
public class AAssessSharpnessHandle extends AlibabaBaseHandle<AAssessSharpnessRequest, AssessSharpnessResponse> {

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


    @Override
    public String check(AAssessSharpnessRequest aAssessSharpnessRequest) {
        return checkUrlBase64(aAssessSharpnessRequest);
    }


    @Override
    public AssessSharpnessResponse run(AAssessSharpnessRequest aAssessSharpnessRequest, RuntimeOptions runtime) throws Exception {
        AssessSharpnessRequest assessSharpnessRequest = new AssessSharpnessRequest();
        assessSharpnessRequest.setImageURL(aAssessSharpnessRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.assessSharpnessWithOptions(assessSharpnessRequest, runtime);
    }
}
