use brepkit_topology::edge::EdgeId;
use brepkit_topology::face::FaceId;
use brepkit_topology::shell::ShellId;
use brepkit_topology::solid::SolidId;
use brepkit_topology::vertex::VertexId;
use brepkit_topology::wire::WireId;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CheckId {
VertexOnCurve,
VertexOnSurface,
EdgeNoCurve3D,
EdgeSameParameter,
EdgeRangeValid,
EdgeDegenerate,
WireEmpty,
WireNotConnected,
WireClosure3D,
WireRedundantEdge,
WireSelfIntersection,
FaceNoSurface,
FaceOrientationConsistency,
ShellEmpty,
ShellConnected,
ShellClosed,
ShellOrientationConsistent,
SolidEulerCharacteristic,
SolidDuplicateFaces,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Severity {
Info,
Warning,
Error,
}
#[derive(Debug, Clone, Copy)]
pub enum EntityRef {
Vertex(VertexId),
Edge(EdgeId),
Wire(WireId),
Face(FaceId),
Shell(ShellId),
Solid(SolidId),
}
#[derive(Debug, Clone)]
pub struct ValidationIssue {
pub check: CheckId,
pub severity: Severity,
pub entity: EntityRef,
pub description: String,
pub deviation: Option<f64>,
}
#[derive(Debug, Clone, Default)]
pub struct ValidationReport {
pub issues: Vec<ValidationIssue>,
}
impl ValidationReport {
#[must_use]
pub fn is_valid(&self) -> bool {
!self.issues.iter().any(|i| i.severity == Severity::Error)
}
#[must_use]
pub fn error_count(&self) -> usize {
self.issues
.iter()
.filter(|i| i.severity == Severity::Error)
.count()
}
#[must_use]
pub fn warning_count(&self) -> usize {
self.issues
.iter()
.filter(|i| i.severity == Severity::Warning)
.count()
}
}