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

import java.util.Objects;

/**
 * Technical failure outcome of {@link TargetFileCopyPort#copyToTarget}.
 * <p>
 * Indicates that copying the source file to the target folder failed. The failure is
 * always treated as a transient, retryable document-level technical error.
 * <p>
 * The {@code targetFileCleanedUp} flag records whether a best-effort cleanup of any
 * partially written temporary target file was successful. A value of {@code false}
 * means a stale temporary file may remain in the target folder; a value of {@code true}
 * means cleanup succeeded (or no temporary file had been created at all).
 *
 * @param errorMessage        human-readable description of the failure; never null
 * @param targetFileCleanedUp {@code true} if cleanup of any temporary file succeeded;
 *                            {@code false} if cleanup failed or was not attempted
 */
public record TargetFileCopyTechnicalFailure(
        String errorMessage,
        boolean targetFileCleanedUp) implements TargetFileCopyResult {

    /**
     * @throws NullPointerException if {@code errorMessage} is null
     */
    public TargetFileCopyTechnicalFailure {
        Objects.requireNonNull(errorMessage, "errorMessage must not be null");
    }
}
