package com.kmall.manager.manager.express.sf.properties;

import com.kmall.manager.manager.express.kdn.KdnDevProperties;
import com.kmall.manager.manager.express.kdn.KdnProdProperties;
import com.kmall.manager.manager.express.kdn.KdnProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author Scott Chen
 * @since 1.0
 * 2018-09-27
 */
@Component
public class SFPropertiesConfiguration {
    private static final String PROD = "prod";
    private static final String DEV = "dev";

    @Value("${express.sf.env}")
    private String evn = PROD;

    @Autowired
    private SFProdProperties sfProdProperties;

    @Autowired
    private SFDevProperties sfDevProperties;

    @Bean
    public SFProperties sfProperties(){
        if (evn.equalsIgnoreCase(PROD)) {
            return sfProdProperties;
        }else {
            return sfDevProperties;
        }
    }

}
