use crate::ValidationError;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidationResult {
pub is_valid: bool,
pub errors: Vec<ValidationError>,
pub warnings: Vec<String>,
}
impl ValidationResult {
pub fn valid() -> Self {
Self {
is_valid: true,
errors: Vec::new(),
warnings: Vec::new(),
}
}
pub fn with_error(error: ValidationError) -> Self {
Self {
is_valid: false,
errors: vec![error],
warnings: Vec::new(),
}
}
pub fn with_errors(errors: Vec<ValidationError>) -> Self {
Self {
is_valid: errors.is_empty(),
errors,
warnings: Vec::new(),
}
}
}