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


import com.aliyun.imageseg20191230.models.ParseFaceRequest;
import com.aliyun.imageseg20191230.models.ParseFaceResponse;
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.AParseFaceRequest;
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/ParseFace?tab=DEMO&lang=JAVA
 * <p>
 * <p>
 * 五官分割
 * <p>
 * ParseFace
 */
@Component
@Slf4j
@CustomPath("parseFace")
public class AParseFaceHandle extends AlibabaBaseHandle<AParseFaceRequest, ParseFaceResponse> {


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

    @Override
    public String check(AParseFaceRequest aParseFaceRequest) {
        return checkUrlBase64(aParseFaceRequest);
    }


    @Override
    public ParseFaceResponse run(AParseFaceRequest aParseFaceRequest, RuntimeOptions runtime) throws Exception {
        ParseFaceRequest parseFaceRequest = new ParseFaceRequest();
        parseFaceRequest.setImageURL(parseFaceRequest.getImageURL());
        // 复制代码运行请自行打印 API 的返回值
        return client.parseFaceWithOptions(parseFaceRequest, runtime);
    }
}
