use serde::{Deserialize, Serialize};
use tower_lsp::lsp_types::notification::Notification;

use crate::core::hdlparam::FastHdlparam;


// 下面是服务端发送给客户端的
#[derive(Serialize, Deserialize)]
pub struct StringNotification {
    pub content: String
}

impl Notification for StringNotification {
    const METHOD: &'static str = "update/string";
    type Params = Self;
}


#[derive(Serialize, Deserialize)]
pub struct UpdateFastNotification {
    pub fast: FastHdlparam,
    pub path: String
}

impl Notification for UpdateFastNotification {
    const METHOD: &'static str = "update/fast";
    type Params = Self;
}

// #[allow(unused)]
// pub async fn update_fast_to_client(fast: FastHdlparam, path: &PathBuf) {
//     // info!("send fast to foreend {:?}", fast);

//     info!("send fast to foreend");
//     let backend = GLOBAL_BACKEND.get().unwrap();
//     let path = path.to_str().unwrap_or("").to_string();
    
//     let params = UpdateFastNotification { fast, path };
//     info!("backend client: {:?}", backend.client);

//     backend.client.send_notification::<UpdateFastNotification>(params).await;
// }