package com.tiedup.remake.client.gltf.diagnostic;

import java.util.List;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

/**
 * Validation result for a single GLB file.
 */
@OnlyIn(Dist.CLIENT)
public record GlbValidationResult(
    ResourceLocation source,
    List<GlbDiagnostic> diagnostics,
    boolean passed
) {
    /** Create a result, computing passed from diagnostics. */
    public static GlbValidationResult of(
        ResourceLocation source,
        List<GlbDiagnostic> diagnostics
    ) {
        boolean passed = diagnostics.stream()
            .noneMatch(d -> d.severity() == GlbDiagnostic.Severity.ERROR);
        return new GlbValidationResult(source, List.copyOf(diagnostics), passed);
    }
}
