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

import com.heyu.api.data.utils.StringUtils;
import com.heyu.api.baidu.BaiduBaseHandle;
import com.heyu.api.baidu.request.convert.BGetRequestResultRequest;
import com.heyu.api.baidu.response.convert.BGetRequestResultResp;
import org.springframework.stereotype.Component;

/***
 * https://console.bce.baidu.com/support/?_=1740667714316&timestamp=1740672313262#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%99%BA%E8%83%BD%E6%96%87%E6%A1%A3%E5%88%86%E6%9E%90&api=rest%2F2.0%2Focr%2Fv1%2Fdoc_convert%2Fget_request_result&method=post
 *
 * 文档格式转换-获取结果
 */
@Component
public class BGetRequestResultHandle extends BaiduBaseHandle<BGetRequestResultRequest, BGetRequestResultResp> {

    @Override
    public String getUri() {
        return "/rest/2.0/ocr/v1/doc_convert/get_request_result";
    }

    @Override
    public String check(BGetRequestResultRequest bGetRequestResultRequest) {
        if (StringUtils.isBlank(bGetRequestResultRequest.getTaskId())) {
            return "taskId is null";
        }
        return null;
    }

    @Override
    public String getContent(BGetRequestResultRequest bGetRequestResultRequest) {

        return "task_id=" + bGetRequestResultRequest.getTaskId();
    }
}
