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


import com.aliyun.facebody20191230.models.DetectPedestrianRequest;
import com.aliyun.facebody20191230.models.DetectPedestrianResponse;
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.ADetectPedestrianRequest;
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/DetectPedestrianIntrusion
 * <p>
 * 行人入侵检测
 *
 * DetectPedestrianIntrusion
 *
 *
 */
@Component
@Slf4j
@CustomPath("detectPedestrian")
public class ADetectPedestrianHandle extends AlibabaBaseHandle<ADetectPedestrianRequest, DetectPedestrianResponse> {


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


    @Override
    public String check(ADetectPedestrianRequest aDetectPedestrianRequest) {
        return checkUrlBase64(aDetectPedestrianRequest);
    }


    @Override
    public DetectPedestrianResponse run(ADetectPedestrianRequest aDetectPedestrianRequest, RuntimeOptions runtime) throws Exception {
        DetectPedestrianRequest detectPedestrianRequest = new DetectPedestrianRequest();
        detectPedestrianRequest.setImageURL(aDetectPedestrianRequest.getImageUrl());

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