// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

pub mod drive;
pub mod sync;

use sync::AppState;
use std::sync::Mutex;

// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}

#[cfg_attr(mobile, tauri::mobile_entry_point)]
fn main() {
        tauri::Builder::default()
        .manage(AppState {
            sync_processes: Mutex::new(Vec::new()),
            sync_active: Mutex::new(false),
        })
        .plugin(tauri_plugin_opener::init())
        .invoke_handler(tauri::generate_handler![
            sync::save_config,
            drive::list_files,
            drive::upload_file,
            drive::create_folder,
            sync::start_sync,
            sync::stop_sync,
            sync::get_status
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

