package catalog

import "strings"

// supportedAgentRuntimeTypes lists runtime values accepted by server-side agent,
// organization-agent and daemon machine capability APIs.
// Desktop daemon owns actual runtime execution; the server only validates,
// filters, and stores these identifiers.
var supportedAgentRuntimeTypes = []string{"claude", "codex", "opencode", "kimi", "pi", "builtin"}

const supportedAgentRuntimeTypesText = "claude, codex, opencode, kimi, pi, or builtin"

// IsSupportedAgentRuntime reports whether runtimeValue is a known runtime ID for
// persisted agent metadata.
func IsSupportedAgentRuntime(runtimeValue string) bool {
	trimmed := strings.TrimSpace(runtimeValue)
	for _, candidate := range supportedAgentRuntimeTypes {
		if trimmed == candidate {
			return true
		}
	}
	return false
}

// UnsupportedAgentRuntimeMessage returns the validation message shared by store
// packages that expose their own BadRequest error type.
func UnsupportedAgentRuntimeMessage() string {
	return "runtime must be " + supportedAgentRuntimeTypesText
}
