//! JSON schema of the report generated by ch-hist.
use std::{collections::BTreeMap, path::PathBuf};

use serde::Deserialize;

#[derive(Deserialize)]
pub struct JsonHistSummaryReport {
    /// Stable API throughout all analysed versions.
    pub stable: Vec<String>,

    /// Unstable API throughout all analysed versions.
    pub unstable: ChangedSymbols,

    /// Changes between each successive version.
    pub changes_per_version: Vec<HeaderDiffSummary>,

    /// Changes for each symbol.
    pub changes_per_symbol: BTreeMap<String, BTreeMap<String, String>>,
}

#[derive(Deserialize)]
pub struct ChangedSymbols {
    pub breaking: Vec<String>,
    pub dubious: Vec<String>,
    pub compatible: Vec<String>,
}

#[derive(Deserialize)]
pub struct HeaderDiffSummary {
    pub version_old: String,
    pub version_new: String,

    pub input_old: PathBuf,
    pub input_new: PathBuf,

    pub changed: ChangedSymbols,
}
