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

import com.aliyun.facebody20191230.models.BodyPostureRequest;
import com.aliyun.facebody20191230.models.BodyPostureResponse;
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.ABodyPostureRequest;
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/BodyPosture
 * 人体姿态关键点
 */
@Component
@Slf4j
@CustomPath("bodyPosture")
public class ABodyPostureHandle extends AlibabaBaseHandle<ABodyPostureRequest, BodyPostureResponse> {

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

    @Override
    public String check(ABodyPostureRequest aBodyPostureRequest) {

        return checkUrlBase64(aBodyPostureRequest);
    }


    @Override
    public BodyPostureResponse run(ABodyPostureRequest aBodyPostureRequest, RuntimeOptions runtime) throws Exception {

        BodyPostureRequest bodyPostureRequest = new BodyPostureRequest();
        bodyPostureRequest.setImageURL(aBodyPostureRequest.getImageUrl());

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


}
