package personality

import "github.com/enmanuel/agents/internal/config"

// FromConfig convierte PersonalityCfg (config) a Personality (tipo puro).
// Esta funcion es pura: no tiene side effects.
func FromConfig(cfg config.PersonalityCfg) Personality {
	return Personality{
		Tone:               Tone(cfg.Tone),
		Verbosity:          Verbosity(cfg.Verbosity),
		Language:           cfg.Language,
		LanguagesSupported: cfg.LanguagesSupported,
		EmojiStyle:         EmojiStyle(cfg.EmojiStyle),
		Prefix:             cfg.Prefix,
		ErrorStyle:         ErrorStyle(cfg.ErrorStyle),
		Templates: Templates{
			Greeting:         cfg.Templates.Greeting,
			UnknownCommand:   cfg.Templates.UnknownCommand,
			PermissionDenied: cfg.Templates.PermissionDenied,
			Error:            cfg.Templates.Error,
			Success:          cfg.Templates.Success,
			Busy:             cfg.Templates.Busy,
		},
		Behavior: Behavior{
			Proactive:          cfg.Behavior.Proactive,
			AskConfirmation:    cfg.Behavior.AskConfirmation,
			ShowReasoning:      cfg.Behavior.ShowReasoning,
			ThreadReplies:      cfg.Behavior.ThreadReplies,
			TypingIndicator:    cfg.Behavior.TypingIndicator,
			AcknowledgeReceipt: cfg.Behavior.AcknowledgeReceipt,
		},
		Role:        cfg.Role,
		Backstory:   cfg.Backstory,
		Expertise:   cfg.Expertise,
		Limitations: cfg.Limitations,
		Communication: Communication{
			Formality:     Formality(cfg.Communication.Formality),
			Humor:         Humor(cfg.Communication.Humor),
			Personality:   PersonalityType(cfg.Communication.Personality),
			ResponseStyle: ResponseStyle(cfg.Communication.ResponseStyle),
			Quirks:        cfg.Communication.Quirks,
			AvoidTopics:   cfg.Communication.AvoidTopics,
			Catchphrases:  cfg.Communication.Catchphrases,
		},
		CustomDirectives: cfg.CustomDirectives,
	}
}
