package com.yn.bftl.thirdparty.common.util;

import com.yn.bftl.common.modules.configuration.entity.ThirdPartyPaySet;
import com.yn.bftl.thirdparty.modules.business.util.ThirdPartyConfigUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author chendehuihuo
 * @date 2022/7/21 10:45
 */

@Configuration
@ConfigurationProperties(prefix = ConfigurationUtil.PREFIX)
public class ConfigurationUtil {

    @Resource
    private ThirdPartyConfigUtil thirdPartyConfigUtil;

    @Value("${spring.profiles.active}")
    public static final String PREFIX = "local";

    public static ThirdPartyPaySet CONFIGURATION = null;

    public static ConfigurationUtil getInstance() {
        return new ConfigurationUtil();
    }

    @Bean
    public void init() {
        CONFIGURATION = toThird();
    }

    public ThirdPartyPaySet toThird() {
        return thirdPartyConfigUtil.getPlatform();
    }
}
