Skip to main content

tackler_core/config/
overlaps.rs

1/*
2 * Tackler-NG 2025
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6//! This module contains the overlap
7//! configuration items to be used e.g. with CLI
8
9use crate::config::{PriceLookupType, StorageType};
10use crate::kernel::settings::GitInputSelector;
11use std::path::PathBuf;
12
13/// Collections of all configuration overlaps
14#[derive(Debug, Default, Clone)]
15pub struct OverlapConfig {
16    /// Audit mode related overlaps
17    pub audit: AuditOverlap,
18    /// Strict mode related overlaps
19    pub strict: StrictOverlap,
20    /// input related overlaps
21    pub storage: StorageOverlap,
22    /// Price DB and conversion related overlaps
23    pub price: PriceOverlap,
24    /// Reporting related overlaps
25    pub report: ReportOverlap,
26    /// Target (reports, exports) related overlaps
27    pub target: TargetOverlap,
28}
29
30#[derive(Debug, Default, Clone)]
31pub struct StorageOverlap {
32    pub storage_type: Option<StorageType>,
33    pub input: Option<InputOverlap>,
34}
35
36/// Input related overlap
37#[derive(Debug, Clone)]
38pub enum InputOverlap {
39    File(FileInputOverlap),
40    Fs(FsInputOverlap),
41    Git(GitInputOverlap),
42}
43
44#[derive(Debug, Clone)]
45pub struct FileInputOverlap {
46    pub path: PathBuf,
47}
48
49#[derive(Debug, Clone)]
50pub struct FsInputOverlap {
51    pub path: Option<String>,
52    pub dir: Option<String>,
53    pub ext: Option<String>,
54}
55
56#[derive(Debug, Clone)]
57pub struct GitInputOverlap {
58    pub repo: Option<String>,
59    pub dir: Option<String>,
60    pub git_ref: Option<GitInputSelector>,
61    pub ext: Option<String>,
62}
63
64/// Audit mode related overlaps
65#[derive(Debug, Default, Clone)]
66pub struct AuditOverlap {
67    /// Audit-mode
68    pub mode: Option<bool>,
69}
70
71/// Strict mode related overlaps
72#[derive(Debug, Default, Clone)]
73pub struct StrictOverlap {
74    /// Strict-mode
75    pub mode: Option<bool>,
76}
77
78/// Price overlap configuration
79#[derive(Debug, Default, Clone)]
80pub struct PriceOverlap {
81    /// Price DB path
82    pub db_path: Option<PathBuf>,
83    /// Price lookup type
84    pub lookup_type: Option<PriceLookupType>,
85    /// Price lookup "before" time(stamp)
86    pub before_time: Option<String>,
87}
88
89/// Report overlap configuration
90#[derive(Debug, Default, Clone)]
91pub struct ReportOverlap {
92    /// Report commodity
93    pub commodity: Option<String>,
94    /// Default reporting account
95    pub account_overlap: Option<Vec<String>>,
96    /// Group-By operator
97    pub group_by: Option<String>,
98    /// Are the report values inverted?
99    pub inverted: bool,
100}
101
102/// Target (reports, exports) overlap configuration
103#[derive(Debug, Default, Clone)]
104pub struct TargetOverlap {
105    /// reports
106    pub reports: Option<Vec<String>>,
107    /// exports
108    pub exports: Option<Vec<String>>,
109    /// Report output formats
110    pub formats: Option<Vec<String>>,
111}