package backend

import "strings"

// imageAttributesSuffix is the fixed English instruction appended to every
// image extraction prompt. It asks the model to additionally emit an
// "attributes" object whose entries become top-level file_tags keys.
const imageAttributesSuffix = `

Additionally, include an "attributes" object in the JSON: each key is a short
attribute name useful for search (for example "style", "scene", "subject",
"color"), and each value is a string, number, or boolean describing this
image. Use at most 30 entries; keys must be at most 64 characters, values at
most 255 characters when rendered as text, and keys must not start with
"drive9.". Do not include objects, arrays, nulls, or attributes you are unsure
about.`

// ComposeImageExtractPrompt returns the effective image extraction prompt:
// the tenant prompt when non-empty, otherwise the built-in default, always
// with imageAttributesSuffix appended. The suffix never substitutes for a
// missing base prompt.
func ComposeImageExtractPrompt(tenantPrompt string) string {
	base := strings.TrimSpace(tenantPrompt)
	if base == "" {
		base = defaultImageExtractPrompt
	}
	return base + imageAttributesSuffix
}
