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

import java.util.Objects;

/**
 * Successful outcome of {@link TargetFolderPort#resolveUniqueFilename(String)}.
 * <p>
 * Carries the first available filename in the target folder. The filename includes
 * the {@code .pdf} extension and, if needed, a numeric duplicate-avoidance suffix
 * inserted directly before {@code .pdf} (e.g., {@code "2024-01-15 - Rechnung(1).pdf"}).
 *
 * @param resolvedFilename the available filename including extension; never null or blank
 */
public record ResolvedTargetFilename(String resolvedFilename) implements TargetFilenameResolutionResult {

    /**
     * @throws NullPointerException     if {@code resolvedFilename} is null
     * @throws IllegalArgumentException if {@code resolvedFilename} is blank
     */
    public ResolvedTargetFilename {
        Objects.requireNonNull(resolvedFilename, "resolvedFilename must not be null");
        if (resolvedFilename.isBlank()) {
            throw new IllegalArgumentException("resolvedFilename must not be blank");
        }
    }
}
