package com.its.bis.config;

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
@ConfigurationProperties(prefix = "server")
public class ServerConfig {

    protected int port;

    private int historyMin = 30;
    private int minSpeed = 3;
    private int maxSpeed = 140;
    private int maxDistance = 20;   // 노드와의 최대 거리(반지름)
    private int maxTrvlMin = 60;    // 지점간 최대 여행시간

    @PostConstruct
    private void init() {
        if (this.maxDistance < 10) {
            this.maxDistance = 10;
        }
        if (this.maxDistance > 50) {
            this.maxDistance = 50;
        }
        log.info("{}", this);
    }

}

