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


import com.aliyun.objectdet20191230.models.DetectWhiteBaseImageRequest;
import com.aliyun.objectdet20191230.models.DetectWhiteBaseImageResponse;
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.objectdet.ADetectWhiteBaseImageRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/objectdet/2019-12-30/DetectWhiteBaseImage?tab=DEMO&lang=JAVA
 * <p>
 * 白底图检测
 * <p>
 * DetectWhiteBaselmage
 */
@Component
@Slf4j
@CustomPath("detectWhiteBaseImage")
public class ADetectWhiteBaseImageHandle extends AlibabaBaseHandle<ADetectWhiteBaseImageRequest, DetectWhiteBaseImageResponse> {

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


    @Override
    public String check(ADetectWhiteBaseImageRequest aDetectWhiteBaseImageRequest) {
        return checkUrlBase64(aDetectWhiteBaseImageRequest);
    }


    @Override
    public DetectWhiteBaseImageResponse run(ADetectWhiteBaseImageRequest aDetectWhiteBaseImageRequest, RuntimeOptions runtime) throws Exception {
        DetectWhiteBaseImageRequest detectWhiteBaseImageRequest = new DetectWhiteBaseImageRequest();
        detectWhiteBaseImageRequest.setImageURL(aDetectWhiteBaseImageRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.detectWhiteBaseImageWithOptions(detectWhiteBaseImageRequest, runtime);
    }
}
