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

import com.aliyun.ocr20191230.models.RecognizeTaxiInvoiceRequest;
import com.aliyun.ocr20191230.models.RecognizeTaxiInvoiceResponse;
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.ARecognizeTaxiInvoiceRequest;
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/RecognizeIdentityCard
 * <p>
 * 出租车发票识别
 */
@Component
@Slf4j
@CustomPath("taxiInvoice")
public class ARecognizeTaxiInvoiceHandle extends AlibabaBaseHandle<ARecognizeTaxiInvoiceRequest, RecognizeTaxiInvoiceResponse> {


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

    @Override
    public String check(ARecognizeTaxiInvoiceRequest aRecognizeTaxiInvoiceRequest) {
        return checkUrlBase64(aRecognizeTaxiInvoiceRequest);
    }


    @Override
    public RecognizeTaxiInvoiceResponse run(ARecognizeTaxiInvoiceRequest aRecognizeTaxiInvoiceRequest, RuntimeOptions runtime) throws Exception {

        RecognizeTaxiInvoiceRequest request = new RecognizeTaxiInvoiceRequest();
        request.setImageURL(aRecognizeTaxiInvoiceRequest.getImageUrl());


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

    }
}
