package com.heyu.api.alibaba.handle.common.text;


import com.aliyun.ocr20191230.models.RecognizeQuotaInvoiceRequest;
import com.aliyun.ocr20191230.models.RecognizeQuotaInvoiceResponse;
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.common.text.ARecognizeQuotaInvoiceRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * https://next.api.aliyun.com/api/ocr/2019-12-30/RecognizeQuotaInvoice
 * <p>
 * 定额发票识别
 */
@Component
@Slf4j
@CustomPath("quotaInvoice")
public class ARecognizeQuotaInvoiceHandle extends AlibabaBaseHandle<ARecognizeQuotaInvoiceRequest, RecognizeQuotaInvoiceResponse> {

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


    @Override
    public String check(ARecognizeQuotaInvoiceRequest aRecognizeQuotaInvoiceRequest) {
        return checkUrlBase64(aRecognizeQuotaInvoiceRequest);
    }


    @Override
    public RecognizeQuotaInvoiceResponse run(ARecognizeQuotaInvoiceRequest arecognizeQuotaInvoiceRequest, RuntimeOptions runtime) throws Exception {

        RecognizeQuotaInvoiceRequest request = new RecognizeQuotaInvoiceRequest();
        request.setImageURL(arecognizeQuotaInvoiceRequest.getImageUrl());


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