2025-04-14 22:05:21 +08:00
|
|
|
use super::SearchResponsePB;
|
2025-04-14 10:36:42 +08:00
|
|
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
2024-04-23 15:46:57 +02:00
|
|
|
|
|
|
|
#[derive(ProtoBuf, Default, Debug, Clone)]
|
2025-04-14 22:05:21 +08:00
|
|
|
pub struct SearchStatePB {
|
2025-04-14 10:36:42 +08:00
|
|
|
#[pb(index = 1, one_of)]
|
2025-04-14 22:05:21 +08:00
|
|
|
pub response: Option<SearchResponsePB>,
|
2024-04-23 15:46:57 +02:00
|
|
|
|
|
|
|
#[pb(index = 2)]
|
2025-04-14 10:36:42 +08:00
|
|
|
pub search_id: String,
|
2024-04-23 15:46:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
|
|
|
pub enum SearchNotification {
|
|
|
|
#[default]
|
|
|
|
Unknown = 0,
|
|
|
|
DidUpdateResults = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::convert::From<SearchNotification> for i32 {
|
|
|
|
fn from(notification: SearchNotification) -> Self {
|
|
|
|
notification as i32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::convert::From<i32> for SearchNotification {
|
|
|
|
fn from(notification: i32) -> Self {
|
|
|
|
match notification {
|
|
|
|
1 => SearchNotification::DidUpdateResults,
|
|
|
|
_ => SearchNotification::Unknown,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|