1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use std::collections::HashMap;

use serde::Deserialize;

use super::util;
use super::progress::ProgressState;

#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct BackupWrapper {
	pub is_unencrypted_or_passphrase_stored: bool,
	pub schedule: Option<Schedule>,
	pub backup: Backup
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Backup {
	#[serde(rename = "ID", deserialize_with = "util::str_to_integer")]
	pub id: u32,
	pub name: String,
	pub description: String,
	pub tags: Vec<String>, // TODO:  HashMap<String, String>
	#[serde(rename = "TargetURL")]
	pub target_url: String,
	#[serde(rename = "DBPath")]
	pub db_path: String,
	// TODO:  Sources, what type goes in the Option?
	// TODO:  Settings, what type goes in the Option?
	// TODO:  Filters, what type goes in the Option?
	pub metadata: HashMap<String, String>, // TODO:  See if we can make a struct for this
	pub is_temporary: bool,
	pub progress: Option<ProgressState>,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Schedule {
	#[serde(rename = "ID")]
	pub id: u64,
	pub tags: Vec<String>, // TODO:  HashMap<String, String>
	pub time: String, // TODO:  Real time type?
	pub repeat: String,
	pub last_run: String, // TODO:  Real time time?
	pub rule: String,
	#[serde(deserialize_with = "util::null_to_empty_vec")]
	pub allowed_days: Vec<String> // TODO:  enum
}