package com.zt.plat.module.base.framework.sync.config;

import okhttp3.OkHttpClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 主数据同步用到的基础配置。
 */
@Configuration
@EnableConfigurationProperties(MasterDataSyncProperties.class)
public class MasterDataSyncConfiguration {

    @Bean
    public OkHttpClient masterDataSyncOkHttpClient(MasterDataSyncProperties properties) {
        MasterDataSyncProperties.HttpProperties http = properties.getHttp();
        return new OkHttpClient.Builder()
                .connectTimeout(http.getConnectTimeout())
                .readTimeout(http.getReadTimeout())
                .writeTimeout(http.getWriteTimeout())
                .build();
    }
}
