use basyx_rs::{DataTypeDefXsd, id_short_from_str};
use basyx_rs::prelude::*;
use std::io::Write;
let mut property = Property::new(DataTypeDefXsd::XsBoolean);
property.category = Some(format!("{}", Category::CONSTANT));
if let Some(id_short) = id_short_from_str("my_property1").ok() {
property.id_short = Some(id_short);
}
let sme = SubmodelElement::Property(property);
let mut submodel = Submodel::new("https://example.com/ids/1234567890".to_string());
submodel.add_submodel_element(sme.clone());
let json = serde_json::to_vec(&submodel);
let mut file = std::fs::OpenOptions::new()
.create(true)
.write(true)
.read(true)
.truncate(true)
.open("submodel1.json");
let json = json.unwrap();
let buf: &[u8] = &json; file.unwrap().write(buf);