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


import com.aliyun.imagerecog20190930.models.RecognizeFoodRequest;
import com.aliyun.imagerecog20190930.models.RecognizeFoodResponse;
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.ARecognizeFoodRequest;
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/RecognizeFood
 * <p>
 * <p>
 * 菜品识别
 * <p>
 * RecognizeFood
 */
@Component
@Slf4j
@CustomPath("detectImageElements")
public class ARecognizeFoodHandle extends AlibabaBaseHandle<ARecognizeFoodRequest, RecognizeFoodResponse> {
    
    @Autowired
    private com.aliyun.imagerecog20190930.Client client;

    @Override
    public String check(ARecognizeFoodRequest aRecognizeFoodRequest) {
        return checkUrlBase64(aRecognizeFoodRequest);
    }



    @Override
    public RecognizeFoodResponse run(ARecognizeFoodRequest aRecognizeFoodRequest, RuntimeOptions runtime) throws Exception {
        RecognizeFoodRequest recognizeFoodRequest = new RecognizeFoodRequest();
        recognizeFoodRequest.setImageURL(aRecognizeFoodRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.recognizeFoodWithOptions(recognizeFoodRequest, runtime);
    }
}
