Skip to main content

plot/lib/logic/
config_model.rs

1use serde::Deserialize;
2
3#[derive(Debug, Deserialize, Clone)]
4pub struct ConfigManifest {
5	pub job: Vec<ConfigJob>,
6}
7
8#[derive(Debug, Deserialize, Clone)]
9pub struct ConfigJob {
10	pub id: String,
11	pub name: Option<String>,
12	pub description: Option<String>,
13	#[serde(default)]
14	pub quiet_work: bool,
15	pub scan: ConfigPattern,
16	pub spec: ConfigSpec,
17	pub table_sotc: ConfigLayout,
18	pub export: Option<ConfigExport>,
19}
20
21#[derive(Debug, Deserialize, Clone)]
22pub struct ConfigPattern {
23	#[serde(default = "default_work_path")]
24	pub work_path: String,
25	pub patterns: Vec<String>,
26	#[serde(default)]
27	pub ignore_case: bool,
28}
29
30#[derive(Debug, Deserialize, Clone)]
31pub struct ConfigSpec {
32	pub mode: String,
33	#[serde(default)]
34	pub hide_stats: bool,
35	#[serde(default)]
36	pub hide_promo: bool,
37	pub trimming: Option<ConfigTrimming>, // Zagnieżdżone w [job.spec.trimming]
38}
39
40#[derive(Debug, Deserialize, Default, Clone)]
41pub struct ConfigLayout {
42	pub sort_by: String,    // Zgodnie z TOML
43	pub sort_order: String, // Zgodnie z TOML
44	pub reverse: bool,
45	pub structure: String,
46	pub columns: Vec<String>,
47	pub trim_page: usize,
48	pub more_icons: bool,
49}
50
51#[derive(Debug, Deserialize, Clone)]
52pub struct ConfigTrimming {
53	pub show_page: Option<usize>,
54	pub page_size: Option<usize>,
55}
56
57#[derive(Debug, Deserialize, Clone)]
58pub struct ConfigExport {
59	pub save_sotc_at: Option<String>,
60	pub title_sotc: Option<String>,
61	pub save_cots_at: Option<String>,
62	pub title_cots: Option<String>,
63}
64
65fn default_work_path() -> String { ".".to_string() }