use std::collections::HashMap;
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub enum ShaclValue {
Str(String),
Int(i64),
Float(f64),
Bool(bool),
List(Vec<String>),
Shapes(Vec<Vec<ConstraintInfo>>),
}
impl ShaclValue {
pub fn as_str(&self) -> Option<&str> {
if let ShaclValue::Str(s) = self { Some(s) } else { None }
}
pub fn as_int(&self) -> Option<i64> {
if let ShaclValue::Int(n) = self { Some(*n) } else { None }
}
pub fn as_float(&self) -> Option<f64> {
match self {
ShaclValue::Float(f) => Some(*f),
ShaclValue::Int(n) => Some(*n as f64),
_ => None,
}
}
pub fn as_list(&self) -> Option<&Vec<String>> {
if let ShaclValue::List(v) = self { Some(v) } else { None }
}
pub fn as_shapes(&self) -> Option<&Vec<Vec<ConstraintInfo>>> {
if let ShaclValue::Shapes(v) = self { Some(v) } else { None }
}
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct ConstraintInfo {
pub path: Vec<String>,
pub severity: String,
pub message: String,
pub name: String,
pub description: String,
pub component: String,
pub payload: HashMap<String, ShaclValue>,
pub rule_id: String,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct TargetInfo {
pub kind: String,
pub value: String,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct ShapeInfo {
pub id: String,
pub targets: Vec<TargetInfo>,
pub path: Vec<String>,
pub name: String,
pub description: String,
pub constraints: Vec<ConstraintInfo>,
pub properties: Vec<ShapeInfo>,
}
#[derive(Debug)]
pub struct FileResults {
pub file_name: String,
pub shapes: Vec<ShapeInfo>,
}