package com.heyu.api.baidu.handle.financial;


import com.heyu.api.baidu.BaiduBaseHandle;
import com.heyu.api.baidu.request.financial.BAirTicketRequest;
import com.heyu.api.baidu.response.financial.BAirTicketResp;
import com.heyu.api.data.annotation.CustomPath;
import com.heyu.api.data.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * https://console.bce.baidu.com/support/?_=1740575657628&timestamp=1740577959399#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fair_ticket&method=post
 * <p>
 * 飞机行程单识别
 */
@Component
@Slf4j
@CustomPath("airTicket")
public class BAirTicketHandle extends BaiduBaseHandle<BAirTicketRequest, BAirTicketResp> {
    @Override
    public String getUri() {
        return "/rest/2.0/ocr/v1/air_ticket";
    }

    @Override
    public String check(BAirTicketRequest bAirTicketRequest) {

        if (checkNotTrueFalse(bAirTicketRequest.getMultiDetect())) {
            return "multiDetect 必须为" + trueOrFalse + ", 控制是否开启多航班信息识别功能";
        }

        return checkOfd(bAirTicketRequest);
    }

    @Override
    public String getContent(BAirTicketRequest bAirTicketRequest) {
        StringBuffer sb = getOfdContent(bAirTicketRequest);
        if(StringUtils.isNotBlank(bAirTicketRequest.getMultiDetect())){
            sb.append("&multi_detect=" + bAirTicketRequest.getMultiDetect());
        }
        return "";
    }
}
