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


import com.aliyun.imageseg20191230.models.SegmentHDBodyRequest;
import com.aliyun.imageseg20191230.models.SegmentHDBodyResponse;
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.imageseg.ASegmentHDBodyRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/imageseg/2019-12-30/SegmentHDBody?tab=DEMO&lang=JAVA
 * <p>
 * <p>
 * 高清人体分割 SegmentHDBody
 */

@Component
@Slf4j
@CustomPath("segmentBody")
public class ASegmentHDBodyHandle extends AlibabaBaseHandle<ASegmentHDBodyRequest, SegmentHDBodyResponse> {

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


    @Override
    public String check(ASegmentHDBodyRequest aSegmentHDBodyRequest) {
        return checkUrlBase64(aSegmentHDBodyRequest);
    }



    @Override
    public SegmentHDBodyResponse run(ASegmentHDBodyRequest aSegmentHDBodyRequest, RuntimeOptions runtime) throws Exception {
        SegmentHDBodyRequest segmentHDBodyRequest = new SegmentHDBodyRequest();
        segmentHDBodyRequest.setImageURL(aSegmentHDBodyRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.segmentHDBodyWithOptions(segmentHDBodyRequest, runtime);
    }
}
