use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TypstAnkifyConfiguration {
#[serde(rename = "ankiconnect-url")]
pub ankiconnect_url: Option<String>,
pub verbose: Option<bool>,
pub setup: Option<serde_json::Value>,
pub cache: Option<CacheOptions>,
pub checks: Option<Checks>,
pub defaults: Option<NoteDefaults>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CacheOptions {
pub enabled: Option<bool>,
#[serde(rename = "custom-file")]
pub custom_file: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Checks {
pub typst: Option<TypstChecks>,
pub ankiconnect: Option<AnkiConnectChecks>,
}
pub type TypstChecks = bool;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnkiConnectChecks {
pub model: Option<bool>,
pub deck: Option<bool>,
pub tags: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Note {
pub label: String,
pub model: String,
pub data: HashMap<String, NoteDataValue>,
pub deck: String,
pub tags: Vec<String>,
pub other: serde_json::Value,
pub format: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompletedNote {
pub label: String,
pub model: String,
pub data: HashMap<String, CompletedNoteDataValueWithFormat>,
pub deck: String,
pub tags: Vec<String>,
pub other: serde_json::Value,
pub format: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum NoteDataValue {
Simple(Option<String>),
WithFormat(NoteDataValueWithFormat),
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NoteDataValueWithFormat {
pub value: Option<String>,
pub format: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CompletedNoteDataValueWithFormat {
pub value: Option<String>,
pub format: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct NoteDefaults {
pub model: Option<String>,
pub deck: Option<String>,
pub tags: Option<Vec<String>>,
pub other: Option<serde_json::Value>,
pub format: Option<String>,
pub render: Option<serde_json::Value>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CompletedTypstAnkifyConfiguration {
#[serde(rename = "ankiconnect-url")]
pub ankiconnect_url: String,
pub verbose: bool,
pub setup: serde_json::Value,
pub cache: CacheOptions,
pub checks: Checks,
pub defaults: NoteDefaults,
}