package com.ywt.outpatient.config;

import com.ywt.biz.common.util.Checker;
import com.ywt.outpatient.api.checkIn.CheckInConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;


/**
 * @author daiyihua
 * @create 2019-01-16 11:54 AM
 * @desc 配置文件传过来的参数配置
 **/
@Configuration
public class ParameterConfigurer {
    private static Logger logger = LoggerFactory.getLogger(ParameterConfigurer.class);

    @Value("${ywt.covid19.list.count}")
    private Integer ywtCovid19ListCount;

    @Value("${com.by.ftp.appid}")
    private String byFtpAppid;

    @Value("${com.by.ftp.appsecret}")
    private String byFtpAppsecret;

    @Value("${com.by.ftp.url}")
    private String byFtpUrl;

    @Value("${com.by.distance}")
    private Integer nearBYDistance;

    public Integer getYwtCovid19ListCount() {
        if (Checker.isNone(ywtCovid19ListCount)){
            return 100;
        }
        return ywtCovid19ListCount;
    }

    public String getByFtpAppid() {
        return byFtpAppid;
    }

    public String getByFtpAppsecret() {
        return byFtpAppsecret;
    }

    public String getByFtpUrl() {
        return byFtpUrl;
    }

    public Integer getNearBYDistance() {
        if (Checker.isNone(nearBYDistance)){
//            logger.info("ParameterConfigurer#getNearBYDistance()1 :{}", nearBYDistance);
            nearBYDistance = CheckInConstants.NEARBY_DISTANCE_NEW;
        }
        logger.info("ParameterConfigurer#getNearBYDistance()2 :{}",nearBYDistance);
        return nearBYDistance;
    }
}
