use cairo_lang_utils::ordered_hash_map::OrderedHashMap;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)]
pub struct DebugInfo {
#[serde(default, skip_serializing_if = "Annotations::is_empty")]
pub annotations: Annotations,
}
pub type Annotations = OrderedHashMap<String, serde_json::Value>;
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct ProgramInformation {
pub program_offset: usize,
}
impl From<ProgramInformation> for Annotations {
fn from(value: ProgramInformation) -> Self {
let mapping = serde_json::to_value(value).unwrap();
OrderedHashMap::from([(
"github.com/software-mansion/cairo-profiler".to_string(),
serde_json::Value::from_iter([("program_info", mapping)]),
)])
}
}