package p.packer.messages;

import p.packer.dtos.PackerAssetDetailsDTO;
import p.packer.dtos.PackerDiagnosticDTO;

import java.util.List;
import java.util.Objects;

public record GetAssetDetailsResult(
        PackerOperationStatus status,
        String summary,
        PackerAssetDetailsDTO details,
        List<PackerDiagnosticDTO> diagnostics) {

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