#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod activity;
mod commands;
mod component_detection;
mod models;
mod singbox_service;
mod storage;
mod subscription;
mod validation;

mod adapters {
    pub mod proxifyre;
    pub mod proxy_router;
    pub mod singbox;
}

#[cfg(test)]
pub(crate) mod proxifyre {
    pub use crate::adapters::proxifyre::*;
}

#[cfg(test)]
pub(crate) mod proxy_router {
    pub use crate::adapters::proxy_router::*;
}

#[cfg(test)]
pub(crate) mod singbox {
    pub use crate::adapters::singbox::*;
}

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_dialog::init())
        .manage(commands::CommandState::default())
        .invoke_handler(tauri::generate_handler![
            commands::get_status,
            commands::get_profiles,
            commands::get_saved_state,
            commands::save_profile,
            commands::get_targets,
            commands::save_target,
            commands::get_components,
            commands::get_proxifyre_setup_status,
            commands::get_singbox_status,
            commands::get_singbox_setup_status,
            commands::resolve_profile_preview,
            commands::save_singbox_subscription,
            commands::fetch_singbox_subscription,
            commands::forget_singbox_subscription,
            commands::select_singbox_server,
            commands::ping_singbox_server,
            commands::ping_all_singbox_servers,
            commands::ping_proxy_target,
            commands::generate_singbox_config,
            commands::apply_profiles,
            commands::get_logs,
            commands::open_config_location,
            commands::start_proxifyre_service,
            commands::stop_proxifyre_service,
            commands::install_proxifyre,
            commands::uninstall_proxifyre,
            commands::start_singbox_service,
            commands::stop_singbox_service,
            commands::install_singbox,
            commands::uninstall_singbox
        ])
        .run(tauri::generate_context!())
        .expect("не удалось запустить клиент VPN Proxy для Windows");
}
