package com.yfd.platform.config;

import org.junit.jupiter.api.Order;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.util.Map;
import java.util.regex.Pattern;


@Configuration("httpServerConfig")
@Order(0)
public class HttpServerConfig {

    @Value("${httpserver.monitorserver.ip}")
    private String monitorIp;

    @Value("${httpserver.monitorserver.port}")
    private String monitorPort;
    @Value("${httpserver.monitorserver.rtspport}")
    private String monitorRtspPort;

    @Value("${httpserver.monitorserver.appname}")
    private String monitorAppname;

    @Value("${httpserver.meidiaserver.ip}")
    private String mediaIp;

    @Value("${httpserver.meidiaserver.port}")
    private String mediaPort;

    @Value("${httpserver.meidiaserver.secret}")
    private String mediaSecret;



    @Value("${httpserver.analyseserver.ip}")
    private String analyseIp;

    @Value("${httpserver.analyseserver.port11}")
    private String analysePort11;

    @Value("${httpserver.analyseserver.port12}")
    private String analysePort12;

    @Value("${httpserver.analyseserver.port13}")
    private String analysePort13;
    @Value("${httpserver.analyseserver.callanalyse}")
    private String callAnalyse;

    @Value("${httpserver.sdkserver.ip}")
    private String sdkIp;

    @Value("${httpserver.sdkserver.haikangport}")
    private String haikangPort;
    @Value("${httpserver.sdkserver.dahuaport}")
    private String dahuaPort;
    @Value("${httpserver.sdkserver.heikaport}")
    private String heikaPort;

    @Value("${httpserver.sdkserver.haikangapp}")
    private String haikangApp;
    @Value("${httpserver.sdkserver.heikaapp}")
    private String heikaApp;
    @Value("${httpserver.sdkserver.dahuaapp}")
    private String dahuaApp;

    @Value("${httpserver.dockserver.ip}")
    private String dockServerIp;
    @Value("${httpserver.dockserver.port}")
    private String dockServerPort;
    @Value("${httpserver.dockserver.app}")
    private String dockServerApp;


    @Value("${httpserver.patrolserver.ip}")
    private String patrolIp;

    @Value("${httpserver.patrolserver.httpport}")
    private String patrolHttpPort;

    @Value("${httpserver.patrolserver.tcpport}")
    private String patrolTcpPort;


    @Value("${httpserver.patrolserver.udpport}")
    private String patrolUdpPort;

    @Value("${httpserver.patrolserver.serverid}")
    private String patrolServerid;

    @Value("${httpserver.patrolserver.robotid}")
    private String robotId;

    @Value("${httpserver.patrolserver.appname}")
    private String patrolAppname;

    //是否执行定时任务
    @Value("${httpserver.patrolserver.dotask}")
    private String doTask;

    @Value("${httpserver.patrolserver.snapfilepath}")
    private String snapFilePath;

    @Value("${httpserver.patrolserver.alarmfilepath}")
    private String alarmFilePath;

    @Value("${httpserver.patrolserver.modelpath}")
    private String modelPath;

    @Value("${httpserver.patrolserver.documentpath}")
    private String documentPath;

    @Value("${httpserver.patrolserver.tempfilepath}")
    private String tempFilePath;

    @Value("${httpserver.patrolserver.ffmpegpath}")
    private String ffmpegPath;

    @Value("${httpserver.patrolserver.callmethod}")
    private String callMethod;

    @Value("${httpserver.patrolserver.filefromtype}")
    private String filefromtype;

    @Value("${httpserver.patrolserver.testfilepath}")
    private String testfilepath;

    public String getMonitorIp() {
        return monitorIp;
    }

    public String getMediaIp() {
        return mediaIp;
    }

    public String getMonitorPort() {
        return monitorPort;
    }

    public String getMonitorRtspPort() {
        return monitorRtspPort;
    }
    public String getMonitorAppname() {
        return monitorAppname;
    }

    public String getAnalyseIp() {
        return analyseIp;
    }

    public String getAnalysePort11() {
        return analysePort11;
    }

    public String getAnalysePort12() {
        return analysePort12;
    }

    public String getAnalysePort13() {
        return analysePort13;
    }

    public String getCallAnalyse() {
        return callAnalyse;
    }

    public String getSdkIp() {
        return sdkIp;
    }

    public String getHaikangApp() {
        return haikangApp;
    }
    public String getDahuaApp() {
        return dahuaApp;
    }
    public String getHeikaApp() {
        return heikaApp;
    }


    public String getHaikangPort() {
        return haikangPort;
    }
    public String getDahuaPort() {
        return dahuaPort;
    }
    public String getHeikaPort() {
        return heikaPort;
    }

    public String getDockServerIp() {
        return dockServerIp;
    }

    public String getDockServerPort() {
        return dockServerPort;
    }

    public String getDockServerApp() {
        return dockServerApp;
    }

    public String getPatrolIp() {
        return patrolIp;
    }

    public String getPatrolPort() {
        return patrolHttpPort;
    }

    public String getPatrolAppname() {
        return patrolAppname;
    }

    public String getPatrolServerid() {
        return patrolServerid;
    }

    public String getRobotId() {
        return robotId;
    }

    public String getPatrolUdpPort() {
        return patrolUdpPort;
    }

    public String getffmpegPath() {
        return ffmpegPath;
    }


    public String getPatrolTcpPort() {
        return patrolTcpPort;
    }

    public String getDoTask() {
        return doTask;
    }

    public String getSnapFilePath() {
        return snapFilePath;
    }

    public String getAlarmFilePath() {
        return alarmFilePath;
    }

    public String getModelPath() {
        return modelPath;
    }

    public String getDocumentPath() {
        return documentPath;
    }

    public String getTempFilePath() {
        return tempFilePath;
    }

    public String getCallMethod() {
        return callMethod;
    }

    public String getFilefromtype() {
        return filefromtype;
    }

    public String getTestfilepath() {
        return testfilepath;
    }

    private boolean isValidIPAddress(String ipAddress) {
        if ((ipAddress != null) && (!ipAddress.isEmpty())) {
            return Pattern.matches("^([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$", ipAddress);
        }
        return false;
    }

}
