# zombiegenz/tank-travel-app architecture

> Architecture diagram of the GitHub repository zombiegenz/tank-travel-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zombiegenz/tank-travel-app
- Repository: https://github.com/zombiegenz/tank-travel-app

## Overview

##### Main Components
- Presentation Layer (UI)
– Views: All the XAML files under the “View” folder (e.g., LoginView, TicketView, ProfileView, etc.)
– ViewModels: The respective viewmodel classes found under “ViewModel” (e.g., LoginViewModel, HomeViewModel, MainViewModel, etc.)
– Controls, Commands, Converters, Helpers: Custom controls (e.g., CircularLoadingControl), RelayCommand implementations, value converters, and input/validation logic that support UI operations.
- Application Services and Business Logic
– Services: NotificationService, and any defined service interfaces under “Services” that facilitate notifications and potentially other cross-cutting concerns.
– Model: Data contracts and API service logic (e.g., ApiServices.cs) that connect and interact with external APIs.
- External API Integration
– Communication with the backend server (documented in the README as the Tank Travel Server Repository) via HttpClient. This includes support for multiple HTTP methods, JWT-based authentication, and handling file uploads.
- Third-party Libraries and Frameworks
– External UI/UX frameworks: Material Design, MahApps.Metro, LiveCharts.
– Libraries for JSON (Newtonsoft.Json) and networking (SocketIOClient and related packages), which indicate both UI enhancements and network requests.

##### Depicting Relationships and Interactions
– How user actions in the Views trigger Commands, which are then handled in the ViewModels.
– Communication between the ViewModels and the Model/Services layer for data retrieval and API interactions.
– How services abstract the remote API communication, including error handling, retry logic, and connection pooling.
- Data flow from the user interface through the business logic layer and out to the external API server.

##### Architectural Patterns & Design Principles
- Clear layering: Separate concerns such as UI rendering, application logic, and external communication.
- Dependency inversion is implied by the use of interfaces (e.g., INotificationService), allowing the application to be more modular and testable.

##### Technology and Frameworks to Highlight
- .NET Framework 4.7.2 (or higher) with WPF for the UI.
- Use of HttpClient for network operations configured with connection pooling, timeout, and error handling.
- Integration of third-party components for UI (e.g., LiveCharts for charts, Material Design and MahApps.Metro for styling).
- Libraries aiding in UI responsiveness (such as custom controls and converters) that enhance the user experience.

##### Elements
- Clear and descriptive labels for each component:
- Presentation: Views, ViewModels, Custom Controls, Converters, Helpers.
- Application Logic: Services, API Service, and Model.
- External System: API Server (Tank Travel Server).
- Data flow (e.g., user interaction → command → viewmodel → API call).
- Dependency relationships (e.g., ViewModels depending on services).
- External libraries or third-party dependencies separately if needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        V["Views (XAML)"]:::frontend
        VM["ViewModels"]:::frontend
        CMD["Commands"]:::frontend
        CTL["Custom Controls"]:::frontend
        CONV["Converters"]:::frontend
        HELP["Helpers"]:::frontend
    end

    subgraph "Application Logic"
        MODEL["Models & API Service"]:::backend
        NSERV["Notification Services"]:::backend
    end

    subgraph "External System"
        API["Remote API Server"]:::external
    end

    V -->|"userInteraction"| VM
    VM -->|"triggerCommand"| CMD
    VM -->|"invokeAPICall"| MODEL
    MODEL -->|"communicatesWith"| API
    VM -->|"requestNotification"| NSERV

    %% UI components support connections
    V -.->|"usesControl"| CTL
    V -.->|"usesConverter"| CONV
    V -.->|"usesHelper"| HELP

    click V "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/View"
    click VM "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/ViewModel"
    click CMD "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/Commands"
    click CTL "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/Controls"
    click CONV "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/Converters"
    click HELP "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/Helpers"
    click MODEL "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/Model"
    click NSERV "https://github.com/zombiegenz/tank-travel-app/tree/master/TiketManagementV2/Services"

    classDef frontend fill:#A8DADC,stroke:#457B9D,stroke-width:2px;
    classDef backend fill:#F4A261,stroke:#E76F51,stroke-width:2px;
    classDef external fill:#E9C46A,stroke:#F4A261,stroke-width:2px;
```
