use crate::{JsonError, Resource};
use serde::Serialize;
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct OpeningSuggestion {
pub label: String,
pub reasons: Vec<String>,
pub reader: String,
pub options: serde_json::Value,
pub inherit: Vec<String>,
}
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
pub struct OpeningSuggestions(pub Vec<OpeningSuggestion>);
impl Resource for OpeningSuggestions {
const NAME: &'static str = "core.opening_suggestions";
fn to_json(&self) -> Result<Option<serde_json::Value>, JsonError> {
crate::json::to_value(self).map(Some)
}
}