use printobserver_printer_api::{
Adjustable, ErrorSource, FileFacts, FilePrint, Footprint, HeaterSnapshot, JobError,
JobSnapshot, PrintedExtent, PrinterSnapshot, ToolFilament,
};
use printobserver_types::contract::TypeContract;
pub fn declared() -> Vec<TypeContract> {
vec![
TypeContract::of::<Adjustable>("Adjustable"),
TypeContract::of::<ErrorSource>("ErrorSource"),
TypeContract::of::<FileFacts>("FileFacts"),
TypeContract::of::<FilePrint>("FilePrint"),
TypeContract::of::<Footprint>("Footprint"),
TypeContract::of::<HeaterSnapshot>("HeaterSnapshot"),
TypeContract::of::<JobError>("JobError"),
TypeContract::of::<JobSnapshot>("JobSnapshot"),
TypeContract::of::<PrintedExtent>("PrintedExtent"),
TypeContract::of::<PrinterSnapshot>("PrinterSnapshot"),
TypeContract::of::<ToolFilament>("ToolFilament"),
]
}
pub fn contract(type_name: &str) -> TypeContract {
declared()
.into_iter()
.find(|entry| entry.name == type_name)
.unwrap_or_else(|| panic!("{type_name} is declared"))
}