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


import com.heyu.api.data.annotation.CustomPath;
import com.heyu.api.data.utils.StringUtils;
import com.heyu.api.baidu.BaiduBaseHandle;
import com.heyu.api.baidu.request.certificate.BBusinesslicenseVerificationStandardRequest;
import com.heyu.api.baidu.response.certificate.BBusinesslicenseVerificationStandardResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1740309953531#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Fbusinesslicense_verification_standard&method=post
 * <p>
 * <p>
 * 企业工商信息查询（标准版）
 */
@Component
@Slf4j
@CustomPath("bouseholdRegister")
public class BBusinesslicenseVerificationStandardHandle extends BaiduBaseHandle<BBusinesslicenseVerificationStandardRequest, BBusinesslicenseVerificationStandardResp> {
    @Override
    public String getUri() {
        return "/rest/2.0/ocr/v1/businesslicense_verification_standard";
    }

    @Override
    public String check(BBusinesslicenseVerificationStandardRequest bBusinesslicenseVerificationStandardRequest) {
        if (StringUtils.isBlank(bBusinesslicenseVerificationStandardRequest.getVerifyNum())) {
            return "verifyNum不能为空，查询关键字段（企业名称、注册号、社会统一信用代码，可任意输入其中一种）";
        }
        return null;
    }

    @Override
    public String getContent(BBusinesslicenseVerificationStandardRequest bBusinesslicenseVerificationStandardRequest) {
        StringBuffer sb = new StringBuffer();
        sb.append("verifynum=").append(bBusinesslicenseVerificationStandardRequest.getVerifyNum());
        return sb.toString();
    }
}
