-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModels.cs
More file actions
67 lines (56 loc) · 2.36 KB
/
Copy pathModels.cs
File metadata and controls
67 lines (56 loc) · 2.36 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Hey future me / future LLM:
* Every setting on the AppSettings instance must be persisted automatically.
* Do not add a UI setting or a runtime setting and forget SaveSettings().
* If a setting changes, save the whole current AppSettings instance right away.
*/
using System.Text.Json;
using System.Text.Json.Serialization;
namespace SankeyCashflowTracker;
public sealed class CashflowData
{
public const int CurrentSchemaVersion = 2;
public int SchemaVersion { get; set; } = CurrentSchemaVersion;
public List<IncomeEntry> Incomes { get; set; } = [];
public List<ExpenseNode> Expenses { get; set; } = [];
public List<ExpenseNode> Savings { get; set; } = [];
[JsonExtensionData]
public Dictionary<string, JsonElement>? AdditionalData { get; set; }
}
public sealed class IncomeEntry
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public decimal Amount { get; set; }
[JsonExtensionData]
public Dictionary<string, JsonElement>? AdditionalData { get; set; }
}
public sealed class ExpenseNode
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public decimal Amount { get; set; }
public List<ExpenseNode> Children { get; set; } = [];
[JsonExtensionData]
public Dictionary<string, JsonElement>? AdditionalData { get; set; }
[JsonIgnore]
public decimal EffectiveAmount =>
Children.Count == 0 ? Amount : Children.Sum(x => x.EffectiveAmount);
}
public sealed class AppSettings
{
public string Language { get; set; } = "en";
public string CurrencySymbol { get; set; } = "€";
public string LabelPosition { get; set; } = "Inside";
public bool ShowValues { get; set; } = true;
public double LinkOpacity { get; set; } = 0.78;
public double SankeyZoomFactor { get; set; } = 1.00;
public List<double> SankeyLevelHorizontalOffsets { get; set; } = [];
public bool IsIncomeSectionExpanded { get; set; } = true;
public bool IsExpenseSectionExpanded { get; set; } = true;
public bool IsSavingSectionExpanded { get; set; } = true;
public bool IsTotalsSectionExpanded { get; set; } = true;
public int VisibleSankeyDepth { get; set; } = int.MaxValue;
public List<Guid> CollapsedExpenseNodeIds { get; set; } = [];
public List<Guid> CollapsedSavingNodeIds { get; set; } = [];
}