tourism 0.1.1

Tourism service library and CLI by aham.ro
fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 1. Export the protos from Buf
    let output = std::process::Command::new("buf")
        .arg("export")
        .arg("buf.build/aham/proto")
        .arg("-o")
        .arg("proto_files")
        .output()
        .expect("failed to execute buf export");

    // 2. Handle stdout (from_utf8_lossy returns a Cow, no expect needed)
    let stdout = String::from_utf8_lossy(&output.stdout);
    if !stdout.is_empty() {
        println!("Buf output: {}", stdout);
    }

    // 3. Compile the protos using tonic-build
    tonic_prost_build::configure()
        .build_server(false)
        .compile_protos(
            &[
                "proto_files/aham/services/iam/iam.proto",
            ],
            &["proto_files"], 
        )?;

    tonic_prost_build::configure()
        .build_server(true)
        .compile_protos(
            &[
                "proto_files/aham/services/tourism/front.proto",
                "proto_files/aham/services/tourism/vo.proto"
            ],
            &["proto_files"], 
        )?;

    // 4. Cleanup
    // Be careful with remove_dir_all; ensure the path is correct
    if std::path::Path::new("proto_files").exists() {
        std::fs::remove_dir_all("proto_files").expect("failed to remove proto_files");
    }
    // copied from vokably
    Ok(())
}