use schemars::schema_for;
use std::fs;
use std::path::Path;
use zenquirer::Questionnaire;
fn main() {
let schema = schema_for!(Questionnaire);
let json = serde_json::to_string_pretty(&schema).expect("Failed to serialize schema");
let out_path = Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.expect("Expected workspace root")
.join("schemas/questionnaire.schema.json");
fs::create_dir_all(out_path.parent().unwrap()).expect("Failed to create schemas directory");
fs::write(&out_path, &json).expect("Failed to write schema file");
println!("Schema written to {}", out_path.display());
}