use tauri::{
    menu::{MenuBuilder, MenuItemBuilder},
    tray::TrayIconBuilder,
};

pub fn create_system_tray() -> tauri::tray::TrayIcon {
    let show = MenuItemBuilder::with_id("show", "Show")
        .build()
        .expect("Failed to create show menu item");

    let hide = MenuItemBuilder::with_id("hide", "Hide")
        .build()
        .expect("Failed to create hide menu item");

    let quit = MenuItemBuilder::with_id("quit", "Quit")
        .build()
        .expect("Failed to create quit menu item");

    let menu = MenuBuilder::new("TrayMenu")
        .item(&show)
        .item(&hide)
        .separator()
        .item(&quit)
        .build()
        .expect("Failed to create tray menu");

    TrayIconBuilder::new()
        .icon(tauri::image::Image::from_bytes(include_bytes!("../icons/tray-icon.png")).unwrap())
        .icon_as_template(true)
        .menu(&menu)
        .menu_on_left_click(true)
        .tooltip("FrenoCorp")
        .build()
        .expect("Failed to create tray icon")
}
