mod commands;

use commands::{
    files::read_text_file,
    network::ping_host,
    router::{
        capture_wireguard_public_key,
        detect_router,
        flash_router,
        flash_router_sysupgrade,
        run_provisioning,
        upload_firmware,
        upload_firmware_to_router,
        upload_provisioning_bundle,
        reconnect_router_after_flash,
        verify_router,
        wait_for_ssh,
        check_router_after_flash,
        upload_udp2raw_setup_script,
        run_udp2raw_setup,
        test_udp2raw_tunnel,
        check_udp2raw_router_status,
        upload_udp2raw_binary
    },
    ssh::{ inspect_router_with_password, probe_router_ssh, remove_known_host },
    controllers::{ list_controller_clients}
};

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder
        ::default()
        .plugin(tauri_plugin_dialog::init())
        .plugin(tauri_plugin_fs::init())
        .invoke_handler(
            tauri::generate_handler![
                read_text_file,
                ping_host,
                remove_known_host,
                probe_router_ssh,
                inspect_router_with_password,
                detect_router,
                upload_firmware,
                upload_firmware_to_router,
                flash_router,
                flash_router_sysupgrade,
                reconnect_router_after_flash,
                wait_for_ssh,
                upload_provisioning_bundle,
                run_provisioning,
                capture_wireguard_public_key,
                verify_router,
                check_router_after_flash,
                upload_udp2raw_setup_script,
                run_udp2raw_setup,
                test_udp2raw_tunnel,
                check_udp2raw_router_status,
                upload_udp2raw_binary,
                list_controller_clients
            ]
        )
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
