package de.gecheckt.pdf.umbenenner.application.port.out;

import java.util.Objects;

import de.gecheckt.pdf.umbenenner.domain.model.PromptIdentifier;

/**
 * Represents successful loading of an external prompt template.
 * <p>
 * The prompt content and a stable identifier for the prompt have both been
 * successfully obtained from the configured external source.
 * <p>
 * <strong>Field semantics:</strong>
 * <ul>
 *   <li>{@link #promptIdentifier()} — a stable, deterministic identifier
 *       (e.g., filename, semantic version, or hash) that will remain the same
 *       across multiple batch runs if the prompt content hasn't changed.</li>
 *   <li>{@link #promptContent()} — the actual prompt template text, ready to be
 *       used in constructing an AI request. May be empty in edge cases, though
 *       normally expected to be meaningful.</li>
 * </ul>
 * <p>
 * The identifier is crucial for historical traceability: each processing attempt
 * records which prompt was used, allowing later investigation of why a particular
 * decision was made.
 *
 * @param promptIdentifier stable identifier for this prompt version; never null
 * @param promptContent    the prompt template text; never null
 */
public record PromptLoadingSuccess(
        PromptIdentifier promptIdentifier,
        String promptContent) implements PromptLoadingResult {

    /**
     * Compact constructor validating mandatory fields.
     *
     * @throws NullPointerException if either field is null
     */
    public PromptLoadingSuccess {
        Objects.requireNonNull(promptIdentifier, "promptIdentifier must not be null");
        Objects.requireNonNull(promptContent, "promptContent must not be null");
    }
}
