//! Testing the CORBA device backend.

use tango::omniorb::CorbaBackend;
use tango::backend::Backend;
use tango::data::IntoData;

use tracing::{debug, info};


#[tokio::main]
async fn main() {

    tracing_subscriber::fmt()
        .with_target(false)
        .with_env_filter(tracing_subscriber::EnvFilter::builder()
            .with_default_directive(tracing_subscriber::filter::LevelFilter::DEBUG.into())
            .from_env_lossy())
        .init();

    let backend = CorbaBackend::init().unwrap();
    let db_dev = backend.connect_database("aculab-db", 10000).await.unwrap();
    debug!(?db_dev, "Database initialized");

    match db_dev.command("DbImportDevice", "elin/master/simu".into_data()).await {
        Ok(out) => {
            info!("DbImportDevice -> {:#?}", out.get());
        }
        Err(e) => {
            info!("DbImportDevice -> {e:#?}");
        }
    }

}
