package main

import (
	"log"

	appConfig "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/config"
	xmppService "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/services"
)

func main() {

	// LOAD APPLICATION CONFIGURATION
	appConfig.Load()

	// Initialise XMPP service
	xmppService.Init()

	// Send online presence stanza
	xmppServiceInstance := xmppService.Instance()

	// Execute send online presence status message for every client and termintate program
	if appConfig.AppConfig.GeneralOptions.ExecuteSingleStatusMessage {
		xmppServiceInstance.ExecuteSingleStatusMessage()
		log.Println("ExecuteSingleStatusMessage finished, online presente status message sent sucessfuly")
		return
	}

	// Keep the servbie running
	xmppServiceInstance.RunOnlinePresenceStatusIndefinetly()
}
