package outreach

import (
	"strings"

	"haixun-backend/internal/library/style8d"
	personadomain "haixun-backend/internal/model/persona/domain/usecase"
)

// FormatVoicePersonaBlock builds the LLM persona block from a full persona profile.
func FormatVoicePersonaBlock(vp *personadomain.PersonaSummary) string {
	if vp == nil {
		return ""
	}
	block := style8d.ResolvePersonaBlock(vp.Persona, vp.StyleProfile, vp.Brief)
	if block == "" {
		return ""
	}
	extras := make([]string, 0, 3)
	if name := strings.TrimSpace(vp.DisplayName); name != "" {
		extras = append(extras, "角色名稱："+name)
	}
	if goals := strings.TrimSpace(vp.Goals); goals != "" {
		extras = append(extras, "回覆目標："+goals)
	}
	if benchmark := strings.TrimSpace(vp.StyleBenchmark); benchmark != "" {
		extras = append(extras, "語氣參考："+benchmark)
	}
	if len(extras) == 0 {
		return block
	}
	return strings.TrimSpace(block + "\n\n" + strings.Join(extras, "\n"))
}
