package com.its.pis.config;

import com.its.app.utils.SysUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Slf4j
@Getter
@Setter
@ToString
@Configuration
//@PropertySource(value = "classpath:application.yml")
@ConfigurationProperties(prefix = "application.process")
public class ProcessConfig {

    private String bootingDateTime;
    private boolean startSchedule;

    private String id = "VDS01";
    private String name = "VDS Communication Server";
    private boolean history = true;
    private boolean statistics = true;

    private String userId = "admin";
    private String userPswd = "1234";

    private String centerBindAddr = "0.0.0.0";
    private int centerBindPort = 9901;
    private boolean centerDump = false;

    private String localBindAddr = "0.0.0.0";
    private int localBindPort = 30100;
    private boolean localDump = false;

    private String facilityIp = "172.16.12.25";
    private int facilitySendPort = 5701;
    private int facilityRecvPort = 5202;

    @PostConstruct
    private void init() {
        this.startSchedule = false;

        if (this.centerBindAddr.equals(""))
            this.centerBindAddr = "0.0.0.0";

        this.bootingDateTime = SysUtils.getSysTimeStr();

        log.info("{}", this);
    }
}
