package p.packer.messages;

import p.packer.dtos.PackerAssetSummaryDTO;
import p.packer.dtos.PackerDiagnosticDTO;

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

public record ListAssetsResult(
        PackerOperationStatus status,
        String summary,
        List<PackerAssetSummaryDTO> assets,
        List<PackerDiagnosticDTO> diagnostics) {

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