package dotnet

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

	"zlh-agent/internal/state"
)

const dotnetBin = "/opt/zlh/runtimes/dotnet/current/dotnet"

func Verify(cfg state.Config) error {
	if _, err := os.Stat(dotnetBin); err != nil {
		return fmt.Errorf("dotnet binary missing at %s", dotnetBin)
	}

	if err := exec.Command(dotnetBin, "--info").Run(); err != nil {
		return fmt.Errorf("dotnet runtime not executable: %w", err)
	}

	return nil
}
