package orch

import (
	"os"

	"ai-workflow-skill/internal/protocol"
)

func resolveBodyValue(body, bodyFile string) (string, error) {
	if body != "" && bodyFile != "" {
		return "", protocol.InvalidInput("body and body-file are mutually exclusive", nil)
	}
	if bodyFile == "" {
		return body, nil
	}

	content, err := os.ReadFile(bodyFile)
	if err != nil {
		return "", protocol.InvalidInput("failed to read body-file", err)
	}
	return string(content), nil
}
