//go:build windows

package deploy

import (
	"fmt"
	"os"
	"os/exec"
)

func SetProcessPriority(priority string) error {
	class := "BelowNormal"
	switch priority {
	case "idle":
		class = "Idle"
	case "below_normal":
		class = "BelowNormal"
	case "normal":
		class = "Normal"
	case "above_normal":
		class = "AboveNormal"
	case "high":
		class = "High"
	}
	pid := os.Getpid()
	cmd := exec.Command("powershell", "-NoProfile", "-Command",
		fmt.Sprintf("(Get-Process -Id %d).PriorityClass = '%s'", pid, class))
	return cmd.Run()
}
