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


import com.aliyun.imagerecog20190930.models.ClassifyingRubbishRequest;
import com.aliyun.imagerecog20190930.models.ClassifyingRubbishResponse;
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.AClassifyingRubbishRequest;
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/ClassifyingRubbish?tab=DEMO&lang=JAVA
 * <p>
 * 垃圾分类识别
 * <p>
 * ClassifyingRubbish
 */
@Component
@Slf4j
@CustomPath("classifyingRubbish")
public class AClassifyingRubbishHandle extends AlibabaBaseHandle<AClassifyingRubbishRequest, ClassifyingRubbishResponse> {

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

    @Override
    public String check(AClassifyingRubbishRequest aClassifyingRubbishRequest) {
        return checkUrlBase64(aClassifyingRubbishRequest);
    }


    @Override
    public ClassifyingRubbishResponse run(AClassifyingRubbishRequest aClassifyingRubbishRequest, RuntimeOptions runtime) throws Exception {
        ClassifyingRubbishRequest classifyingRubbishRequest   = new ClassifyingRubbishRequest();
        classifyingRubbishRequest.setImageURL(aClassifyingRubbishRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.classifyingRubbishWithOptions(classifyingRubbishRequest, runtime);
    }
}
