use serde::{Deserialize, Serialize};
use crate::diagnostics::Diagnostic;
use super::types::{AspectResult, ChangeCategory, CompatibilityLevel};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CompatibilityReport {
pub level: CompatibilityLevel,
pub aspects: Vec<AspectResult>,
pub diagnostics: Vec<Diagnostic>,
}
impl CompatibilityReport {
#[must_use]
pub fn is_compatible(&self) -> bool {
!matches!(self.level, CompatibilityLevel::Incompatible)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ContractChange {
pub category: ChangeCategory,
pub message: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_ref: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EvolutionReport {
pub source_id: String,
pub target_id: String,
pub same_identity: bool,
pub compatibility: CompatibilityLevel,
pub changes: Vec<ContractChange>,
pub migration_hints: Vec<String>,
pub diagnostics: Vec<Diagnostic>,
}