package p.packer.messages;

import p.packer.dtos.PackerDiagnosticDTO;

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

public record InitWorkspaceResult(
        PackerOperationStatus status,
        String summary,
        Path registryPath,
        List<PackerDiagnosticDTO> diagnostics) {

    public InitWorkspaceResult {
        Objects.requireNonNull(status, "status");
        summary = Objects.requireNonNull(summary, "summary").trim();
        registryPath = Objects.requireNonNull(registryPath, "registryPath").toAbsolutePath().normalize();
        diagnostics = List.copyOf(Objects.requireNonNull(diagnostics, "diagnostics"));
        if (summary.isBlank()) {
            throw new IllegalArgumentException("summary must not be blank");
        }
    }
}
