ocpi_tariffs/explain.rs
1//! Explain an OCPI object in human language.
2//!
3//! Where schema validation flags problems in a tariff, `explain` describes what a tariff
4//! actually does: what it charges, for which dimension, and how the rate changes as a session
5//! progresses. The explanation folds in how `ocpi-tariffs` interprets the spec, not just the raw
6//! field values.
7//!
8//! Use [`tariff::explain`](crate::tariff::explain) to explain a tariff.
9
10#[cfg(test)]
11mod test;
12
13#[cfg(test)]
14mod test_nl_nl;
15
16#[cfg(test)]
17mod test_real_world;
18
19mod ir;
20mod render;
21pub mod tariff;
22
23#[doc(inline)]
24pub use render::Language;
25
26use crate::{tariff::Warning, Verdict};
27
28/// Explain the given tariff in the given language and return the explanation as Markdown.
29pub(crate) fn tariff(
30 tariff: &crate::tariff::Versioned<'_>,
31 language: Language,
32) -> Verdict<String, Warning> {
33 tariff::explain(tariff, language)
34}