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

import java.util.Objects;

/**
 * Represents failure to load an external prompt template.
 * <p>
 * The prompt could not be obtained from the configured external source,
 * or the loaded content was technically invalid (e.g., empty after trimming).
 * <p>
 * <strong>Field semantics:</strong>
 * <ul>
 *   <li>{@link #failureReason()} — a classification of the failure type
 *       (e.g., "FILE_NOT_FOUND", "IO_ERROR", "EMPTY_CONTENT")</li>
 *   <li>{@link #failureMessage()} — a human-readable description of why
 *       the load failed, suitable for logging and debugging</li>
 * </ul>
 * <p>
 * This is a technical failure, not a validation error, and typically prevents
 * the batch run from proceeding further (may lead to a {@code PROCESSING} status
 * treated as {@code FAILED_RETRYABLE}).
 *
 * @param failureReason  classification of the failure (non-null, may be empty)
 * @param failureMessage human-readable failure description (non-null, may be empty)
 */
public record PromptLoadingFailure(
        String failureReason,
        String failureMessage) implements PromptLoadingResult {

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