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


import com.aliyun.facebody20191230.models.HandPostureRequest;
import com.aliyun.facebody20191230.models.HandPostureResponse;
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.AHandPostureRequest;
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/HandPosture
 * 手势关键点检测
 * <p>
 * HandPosture
 */
@Component
@Slf4j
@CustomPath("handPosture")
public class AHandPostureHandle extends AlibabaBaseHandle<AHandPostureRequest, HandPostureResponse> {

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

    @Override
    public String check(AHandPostureRequest aHandPostureRequest) {
        return checkUrlBase64(aHandPostureRequest);
    }

    @Override
    public HandPostureResponse run(AHandPostureRequest aHandPostureRequest, RuntimeOptions runtime) throws Exception {

        HandPostureRequest  handPostureRequest = new HandPostureRequest();
        handPostureRequest.setImageURL(aHandPostureRequest.getImageUrl());

        // 复制代码运行请自行打印 API 的返回值
        return client.handPostureWithOptions(handPostureRequest, runtime);
    }
}
