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


import com.aliyun.imagerecog20190930.models.RecognizeSceneRequest;
import com.aliyun.imagerecog20190930.models.RecognizeSceneResponse;
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.imagerecog.ARecognizeSceneRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/imagerecog/2019-09-30/RecognizeScene?tab=DEMO&lang=JAVA
 * <p>
 * 场景识别
 * <p>
 * RecognizeScene
 */
@Component
@Slf4j
@CustomPath("scene")
public class ARecognizeSceneHandle extends AlibabaBaseHandle<ARecognizeSceneRequest, RecognizeSceneResponse> {

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


    @Override
    public String check(ARecognizeSceneRequest aRecognizeSceneRequest) {
        return checkUrlBase64(aRecognizeSceneRequest);
    }


    @Override
    public RecognizeSceneResponse run(ARecognizeSceneRequest aRecognizeSceneRequest, RuntimeOptions runtime) throws Exception {
        RecognizeSceneRequest recognizeSceneRequest = new RecognizeSceneRequest();
        recognizeSceneRequest.setImageURL(aRecognizeSceneRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.recognizeSceneWithOptions(recognizeSceneRequest, runtime);
    }
}
