package com.community.huiju.config;

import com.community.commom.fushi.FuShiHttpClient;
import com.community.commom.fushi.FuShiRequestAPI;
import com.community.huiju.common.perproties.FuShiProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 富士配置类
 * @author weiximei
 */
@Configuration
public class FuShiConfig {

    @Autowired
    private FuShiProperties fuShiProperties;


    /**
     * 初始化富士HTTP客户端
     * @return FuShiHttpClient
     */
    @Bean
    public FuShiHttpClient fuShiHttpClient() {
        return new FuShiHttpClient(fuShiProperties.getUrl(), fuShiProperties.getAppid(), fuShiProperties.getAppSecret(), fuShiProperties.getPrivateKey());
    }

    /**
     * 初始化富士请求 API
     * @param fuShiHttpClient
     * @return
     */
    @Bean
    public FuShiRequestAPI fuShiRequestAPI(FuShiHttpClient fuShiHttpClient) {
        return new FuShiRequestAPI(fuShiHttpClient);
    }

}
