package logger

import (
	"fmt"
	"jannex/robot-control-manager/modules/utils"

	"git.ex.umbach.dev/Alex/roese-utils/rslogger"
	"github.com/gofiber/fiber/v2"
)

func AddSystemLog(logType string, format string, v ...any) {
	go rslogger.LogManagerRequestClient(fiber.MethodPost, rslogger.LogManagerRequestBody{
		Type: "robot-control-manager",
		Logs: []string{logType + rslogger.GetTime() + fmt.Sprintf(format, v...)}})
}

func AddRobotLog(logType string, robotType uint8, robotId string, format string, v ...any) {
	var lType string

	if robotType == utils.RobotTypeRex {
		lType = "rex"
	} else {
		lType = "yeet"
	}

	go rslogger.LogManagerRequestClient(fiber.MethodPost, rslogger.LogManagerRequestBody{
		Type: lType + "-" + robotId,
		Logs: []string{logType + rslogger.GetTime() + fmt.Sprintf(format, v...)}})
}
