package com.zhpb.gdyd_zhpb_zgf.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhpb.gdyd_zhpb_zgf.service.UmiOcrClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * Umi-OCR 配置类
 */
@Configuration
public class UmiOcrConfig {

    @Value("${umi-ocr.base-url:http://127.0.0.1:1224}")
    private String baseUrl;

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean
    public UmiOcrClient umiOcrClient(RestTemplate restTemplate, ObjectMapper objectMapper) {
        return new UmiOcrClient(baseUrl, restTemplate, objectMapper);
    }
}
