package p.packer.models;

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

public record PackerAssetDeclarationParseResult(
        PackerAssetDeclaration declaration,
        List<PackerDiagnostic> diagnostics) {

    public PackerAssetDeclarationParseResult {
        diagnostics = List.copyOf(Objects.requireNonNull(diagnostics, "diagnostics"));
    }

    public boolean valid() {
        return declaration != null && diagnostics.stream().noneMatch(PackerDiagnostic::blocking);
    }
}
