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

import com.aliyun.facebody20191230.models.RecognizeHandGestureRequest;
import com.aliyun.facebody20191230.models.RecognizeHandGestureResponse;
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.facebody.ARecognizeHandGestureRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * https://next.api.aliyun.com/api/facebody/2019-12-30/RecognizeHandGesture
 * 静态手势识别
 */

@Component
@Slf4j
@CustomPath("handGesture")
public class ARecognizeHandGestureHandle extends AlibabaBaseHandle<ARecognizeHandGestureRequest, RecognizeHandGestureResponse> {


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


    @Override
    public String check(ARecognizeHandGestureRequest aRecognizeHandGestureRequest) {
        return checkUrlBase64(aRecognizeHandGestureRequest);
    }

    @Override
    public RecognizeHandGestureResponse run(ARecognizeHandGestureRequest aRecognizeHandGestureRequest, RuntimeOptions runtime) throws Exception {
        RecognizeHandGestureRequest recognizeHandGestureRequest = new RecognizeHandGestureRequest();
        recognizeHandGestureRequest.setImageURL(aRecognizeHandGestureRequest.getImageUrl());
        recognizeHandGestureRequest.setGestureType(aRecognizeHandGestureRequest.getGestureType());
        recognizeHandGestureRequest.setAppId(aRecognizeHandGestureRequest.getAppId());
        // 复制代码运行请自行打印 API 的返回值
        return client.recognizeHandGestureWithOptions(recognizeHandGestureRequest, runtime);
    }
}
