package main

import (
	"context"
	"log"
	"os"
	"os/signal"
	"syscall"

	"git.az-it.net/az/morz-infoboard/player/agent/internal/app"
)

func main() {
	logger := log.New(os.Stdout, "agent ", log.LstdFlags|log.LUTC)

	application, err := app.New()
	if err != nil {
		logger.Fatalf("init agent: %v", err)
	}

	logger.Printf("event=agent_starting screen_id=%s", application.Config.ScreenID)

	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
	defer stop()

	if err := application.Run(ctx); err != nil {
		logger.Fatalf("run agent: %v", err)
	}
}
