# lg2de/simpleaccounting architecture

> Architecture diagram of the GitHub repository lg2de/simpleaccounting, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lg2de/simpleaccounting
- Repository: https://github.com/lg2de/simpleaccounting

## Overview

##### Main Architectural Layers (Use vertical layers)

Top Layer - Presentation (UI)
- WPF Views (.xaml files)
- ViewModels (MVVM pattern)
- UI Controls and Converters

Middle Layer - Business Logic
- Model (AccountingData)
- Reports
- Infrastructure Services

Bottom Layer - Data Access & Abstractions
- File System Operations
- XML Data Storage
- External Systems Integration

- XML data persistence flow
- Demonstrate CSV import flow
- Report generation flow
- Update check/application flow

- CSV Import Interface
- XML File Storage
- Application Update System

##### MVVM Architecture
- Clear separation between Views and ViewModels
- Use of Commands for user interactions
- Data binding patterns

##### Modularity
- Abstracted services (IFileSystem, IDialogs, etc.)
- Report generation system
- Import/Export capabilities

##### Data Management
- XML-based storage
- Schema validation
- Data model structure

Specific Implementation Notes:

- Blue: UI Components
- Green: Business Logic
- Yellow: Data Access
- Gray: External Services
- Purple: Report System

**→ : Direct Dependencies**
**⇢ : Data Flow**
**⇄ : Two-way Communication**

##### Update System

Remember to highlight the localization support (EN/DE/FR) and the XML-based data storage with XSD validation as these are key architectural features of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef service fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef report fill:#9b59b6,stroke:#8e44ad,color:white

    %% Presentation Layer
    subgraph Presentation
        Shell["Shell (Main Container)"]:::ui
        BookingUI["Booking System UI"]:::ui
        ViewModels["ViewModels"]:::ui
        UIControls["UI Controls & Converters"]:::ui
    end

    %% Business Logic Layer
    subgraph BusinessLogic
        AccountingModel["Accounting Model"]:::business
        ProjectMgmt["Project Management"]:::business
        BookingSystem["Booking System"]:::business
        ReportGen["Report Generator"]:::business
    end

    %% Reports Module
    subgraph Reports
        AccountJournal["Account Journal"]:::report
        AnnualBalance["Annual Balance"]:::report
        TotalJournal["Total Journal"]:::report
        TotalsBalances["Totals & Balances"]:::report
    end

    %% Services
    subgraph Services
        FileSystem["File System Service"]:::service
        UpdateService["Update Service"]:::service
        ImportService["Import Service (CSV)"]:::service
        DialogService["Dialog Service"]:::service
        ClockService["Clock Service"]:::service
    end

    %% Data Layer
    subgraph DataAccess
        XMLStorage["XML Storage"]:::data
        XMLValidation["XSD Validation"]:::data
        CSVImport["CSV Import"]:::data
    end

    %% Relationships
    Shell --> ViewModels
    Shell --> UIControls
    ViewModels --> BookingSystem
    ViewModels --> ProjectMgmt
    BookingUI --> BookingSystem
    BookingSystem --> AccountingModel
    AccountingModel --> XMLStorage
    ReportGen --> Reports
    ImportService --> CSVImport
    CSVImport --> BookingSystem
    XMLStorage --> XMLValidation
    ReportGen --> AccountingModel
    BookingSystem --> FileSystem
    Shell --> UpdateService
    Shell --> DialogService
    BookingSystem --> ClockService

    %% Click Events
    click Shell "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Presentation/ShellView.xaml"
    click AccountingModel "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Model/AccountingData.designer.cs"
    click ReportGen "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Reports/ReportFactory.cs"
    click BookingUI "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Presentation/EditBookingView.xaml"
    click FileSystem "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Abstractions/IFileSystem.cs"
    click UpdateService "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Infrastructure/ApplicationUpdate.cs"
    click ImportService "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Infrastructure/ImportFileLoader.cs"
    click DialogService "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Abstractions/IDialogs.cs"
    click ClockService "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Abstractions/IClock.cs"
    click AccountJournal "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Reports/AccountJournalReport.cs"
    click AnnualBalance "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Reports/AnnualBalanceReport.cs"
    click TotalJournal "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Reports/TotalJournalReport.cs"
    click TotalsBalances "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Reports/TotalsAndBalancesReport.cs"
    click XMLStorage "https://github.com/lg2de/SimpleAccounting/blob/main/src/SimpleAccounting/Model/AccountingData.xsd"

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        BL["Business Logic"]:::business
        DA["Data Access"]:::data
        SV["Service"]:::service
        RP["Report"]:::report
    end
```
