package de.gecheckt.pdf.umbenenner.domain.model;

import java.util.Objects;

/**
 * Represents a content-related failure during PDF text extraction.
 * <p>
 * This indicates that the PDF file itself is readable (no I/O error),
 * but its content is not suitable for text extraction.
 * <p>
 * Examples: PDF is image-only (not OCR'd), PDF is encrypted and cannot be unlocked,
 * PDF is severely corrupted in the content layer.
 * <p>
 * This is typically a deterministic, non-retryable condition for a given source file
 * (unless the source file is modified and re-scanned in a later run).
 *
 * @param reason a human-readable explanation of why extraction failed (non-null, non-empty)
 */
public record PdfExtractionContentError(
    String reason
) implements PdfExtractionResult {
    /**
     * Constructor with validation.
     *
     * @param reason must be non-null and non-empty
     * @throws NullPointerException if reason is null
     * @throws IllegalArgumentException if reason is empty
     */
    public PdfExtractionContentError {
        Objects.requireNonNull(reason, "reason must not be null");
        if (reason.isEmpty()) {
            throw new IllegalArgumentException("reason must not be empty");
        }
    }
}
