package com.pablotj.ia.chat.boot.application.prompt;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class PromptDefinition {

    private String character;
    private String identity;
    private List<String> knowledge;
    private String tone;
    private String communicationStyle;
    private List<String> rules;
    private String context;
    private String style;
    private String formatting;
    private String closing;

    public String buildPrompt() {
        return Stream.of(
                        character,
                        identity,
                        knowledge != null ? String.join(" ", knowledge) : null,
                        tone,
                        communicationStyle,
                        rules != null ? String.join(" ", rules) : null,
                        context,
                        style,
                        formatting,
                        closing
                ).filter(Objects::nonNull)
                .filter(s -> !s.isBlank())
                .collect(Collectors.joining("\n\n"));
    }

    // Getters y setters (requeridos por Jackson)

    public String getCharacter() { return character; }
    public void setCharacter(String character) { this.character = character; }

    public String getIdentity() { return identity; }
    public void setIdentity(String identity) { this.identity = identity; }

    public List<String> getKnowledge() { return knowledge; }
    public void setKnowledge(List<String> knowledge) { this.knowledge = knowledge; }

    public String getTone() { return tone; }
    public void setTone(String tone) { this.tone = tone; }

    public String getCommunicationStyle() { return communicationStyle; }
    public void setCommunicationStyle(String communicationStyle) { this.communicationStyle = communicationStyle; }

    public List<String> getRules() { return rules; }
    public void setRules(List<String> rules) { this.rules = rules; }

    public String getContext() { return context; }
    public void setContext(String context) { this.context = context; }

    public String getStyle() { return style; }
    public void setStyle(String style) { this.style = style; }

    public String getFormatting() { return formatting; }
    public void setFormatting(String formatting) { this.formatting = formatting; }

    public String getClosing() { return closing; }
    public void setClosing(String closing) { this.closing = closing; }
}
