use std::collections::HashMap; use super::{AccountName, UnitName}; #[derive(Debug, serde::Deserialize, PartialEq)] #[serde(deny_unknown_fields, rename_all = "snake_case")] pub enum CsvColumnSpec { Ignore, Datestamp, Title, Deposit, Withdraw, Change, Balance, Unit, } #[derive(Debug, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct CsvImportSpec { pub skip_start: Option, pub skip_end: Option, pub cols: Vec, pub date_format: String, } #[derive(Debug, serde::Deserialize)] #[serde(deny_unknown_fields, tag = "format", rename_all = "snake_case")] pub enum ImportFileFormat { Csv(CsvImportSpec), } #[derive(Debug, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct AccountSpec { pub title: Option, pub description: Option, pub annotations: Option>, pub unit: Option, pub import: Option, } #[derive(Debug, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct UnitSpec { pub name: UnitName, pub precision: Option, } #[derive(Debug, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct SpecRoot { pub ledger_path: std::path::PathBuf, pub units: HashMap, pub accounts: HashMap, }