package profile

import (
	"os"
	"path/filepath"

	"github.com/tidbcloud/AgentTeam/desktop/internal/agent/runtimeconfig"
)

func getRuntimeConfigPathsFromRuntimes(_ map[string]*runtimeconfig.Runtime) map[string]string {
	paths := make(map[string]string)
	home, _ := os.UserHomeDir()
	if home == "" {
		return paths
	}

	p := filepath.Join(home, ".config", "opencode", "opencode.jsonc")
	if _, err := os.Stat(p); err == nil {
		paths["opencode"] = p
	} else {
		p2 := filepath.Join(home, ".config", "opencode", "opencode.json")
		if _, err := os.Stat(p2); err == nil {
			paths["opencode"] = p2
		} else {
			paths["opencode"] = p
		}
	}

	p = filepath.Join(home, ".claude", "settings.json")
	paths["claude"] = p

	p = filepath.Join(home, ".codex", "config.toml")
	paths["codex"] = p

	return paths
}
