package com.its.onvif.cmra.server.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Slf4j
@Data
@Component
@ConfigurationProperties(prefix = "application")
public class ApplicationConfig {

    private String bootingTime;
    private String processId = "cmra-onvif-server";

    private int packetQueueSize = 0;
    private int dbmsQueueSize = 0;

    @PostConstruct
    private void init() {

//        this.bootingTime = TimeUtils.now();


        if (this.packetQueueSize <= 0) {
            this.packetQueueSize = 100;
        }
        if (this.dbmsQueueSize <= 0) {
            this.dbmsQueueSize = 100;
        }

        log.info("[ApplicationConfig] -------------------------");
        log.info("[ApplicationConfig]             processId: {}", this.processId);
        log.info("[ApplicationConfig]       packetQueueSize: {}", this.packetQueueSize);
        log.info("[ApplicationConfig]         dbmsQueueSize: {}", this.dbmsQueueSize);
    }

}
