package p.packer.models;

import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

public record PackerMoveAssetEvaluation(
        PackerResolvedAssetReference resolved,
        List<PackerDiagnostic> diagnostics,
        boolean canMove,
        String reason,
        Optional<String> targetRelativeRoot,
        Optional<Path> targetRoot,
        Optional<Path> targetManifestPath) {

    public PackerMoveAssetEvaluation {
        Objects.requireNonNull(resolved, "resolved");
        diagnostics = List.copyOf(Objects.requireNonNull(diagnostics, "diagnostics"));
        reason = reason == null ? null : reason.trim();
        if (reason != null && reason.isBlank()) {
            reason = null;
        }
        targetRelativeRoot = Objects.requireNonNull(targetRelativeRoot, "targetRelativeRoot");
        targetRoot = Objects.requireNonNull(targetRoot, "targetRoot");
        targetManifestPath = Objects.requireNonNull(targetManifestPath, "targetManifestPath");
    }
}
