package docforge

import "strings"

// PlaceholderMap is the variable bag a ResolverSet builds and a format
// exporter fills into a template. Keys are dotted paths without braces
// (e.g. "project.case_number"); values are the substituted text — already
// locale-aware, pretty-printed, and sanitised by the resolvers that
// produced them.
//
// It is format-neutral: the .docx exporter substitutes these into OOXML,
// but a future PDF/HTML/Markdown exporter consumes the same bag. The
// {{key}} substitution grammar itself is the exporter's concern and lives
// with the adapter (pkg/docforge/docx), not here.
type PlaceholderMap map[string]string

// MissingPlaceholderFn translates an unbound placeholder key into the
// in-document marker token. DefaultMissingMarker returns the standard
// "[KEIN WERT: <key>]" / "[NO VALUE: <key>]" form.
type MissingPlaceholderFn func(key string) string

// DefaultMissingMarker returns the standard missing-value marker for the
// given UI language. Unbound placeholders render this marker inline so the
// lawyer sees the gap in the document rather than the render failing.
func DefaultMissingMarker(lang string) MissingPlaceholderFn {
	prefix := "KEIN WERT"
	if strings.EqualFold(lang, "en") {
		prefix = "NO VALUE"
	}
	return func(key string) string {
		return "[" + prefix + ": " + key + "]"
	}
}
