# singletonsean/reservoom architecture

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

- Interactive diagram: https://gitdiagram.com/singletonsean/reservoom
- Repository: https://github.com/singletonsean/reservoom

## Overview

##### Main Components
- User Interface Layer:
- Views: XAML files (e.g., MainWindow.xaml, MakeReservationView.xaml, ReservationListingView.xaml) that define the UI.
- ViewModels: Classes in the “src/Reservoom/ViewModels” folder (e.g., MainViewModel, MakeReservationViewModel, ReservationListingViewModel, and ReservationViewModel) that handle UI logic.
- Commands: Classes under “src/Reservoom/Commands” (e.g., MakeReservationCommand, LoadReservationsCommand, NavigateCommand, etc.) that facilitate user interactions.
- Converters: E.g., InverseBooleanToVisibilityConverter, to support view state changes.

- Business Logic and Domain Layer:
- Models: Defined in “src/Reservoom/Models” (e.g., Hotel, Reservation, RoomID, ReservationBook) which represent the domain entities.
- DTOs: Representing data transfer objects for reservations (ReservationDTO).

- Data Access Layer:
- DbContexts: The “src/Reservoom/DbContexts” directory contains EF Core DbContext classes and factories, migrations that handle the database abstraction.
- Migrations: Infrastructure (Initial migration, model snapshot) for evolving the database.

- Services Layer:
- Navigation Service: Handles view transitions.
- Reservation Providers, Creators, and Conflict Validators: These are implemented as separate services (e.g., DatabaseReservationCreator, DatabaseReservationProvider, DatabaseReservationConflictValidator) that encapsulate business rules and data validation for reservations.

- Stores and Host Builders:
- Stores (HotelStore, NavigationStore) that manage state.
- HostBuilders: Extensions for wiring up ViewModels and probably dependency injection.

- Testing Components:
- End-to-End and Unit Test Projects under “src/Reservoom.Test.E2E” and “src/Reservoom.Test”, which show a commitment to verifying both the UI and business logic layers.

##### Relationships and Data Flow
- The UI (Views) is bound to corresponding ViewModels, which in turn use Commands to handle user actions.
- ViewModels interact with the Services layer to create reservations, validate conflicts, and navigate between views.
- The Services layer interacts with the Data Access Layer (DbContexts) to read/write reservation and hotel data.
- Models are shared across Layers to maintain business logic, while DTOs mediate the data transfer between the backend and UI.
- Testing components mimic these interactions to validate the end-to-end flow and core business functionality.

##### Architectural Patterns and Key Technologies
- MVVM Pattern: Clear separation between UI (Views), business logic (ViewModels and Services), and the Model.
- Dependency Injection: Likely used with the HostBuilders to wire-up dependencies, especially within a WPF context.
- Entity Framework Core: Evidenced by the presence of DbContext, factories, and Migrations.
- Command Pattern: To encapsulate UI actions.
- Testing Layers: Incorporating unit and end-to-end tests to ensure reliability.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer (UI)
    subgraph "Presentation Layer (UI)"
        U1["Views"]
        U2["ViewModels"]
        U3["Commands"]
        U4["Converters"]
    end

    %% Domain Layer
    subgraph "Domain Layer"
        D1["Domain Models"]
        D2["DTOs"]
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        DA1["DbContext"]
        DA2["Migrations"]
    end

    %% Services Layer
    subgraph "Services Layer"
        S1["Navigation Service"]
        S2["Reservation Creator"]
        S3["Reservation Provider"]
        S4["Conflict Validator"]
    end

    %% Infrastructure
    subgraph "Infrastructure"
        I1["Stores"]
        I2["HostBuilders"]
    end

    %% Testing
    subgraph "Testing"
        T1["Unit Tests"]
        T2["E2E Tests"]
    end

    %% Relationships
    U1 -->|"bindsTo"| U2
    U1 -->|"uses"| U4
    U2 -->|"executes"| U3
    U2 -->|"manipulates"| D1
    U2 -->|"transfersDataWith"| D2
    U2 -->|"invokes"| S1
    U2 -->|"invokes"| S2
    U2 -->|"invokes"| S3
    U2 -->|"invokes"| S4
    S2 -->|"calls"| DA1
    S3 -->|"calls"| DA1
    S4 -->|"calls"| DA1
    S1 -.->|"configuredBy"| I2
    I1 -->|"managesStateOf"| U2
    I2 -->|"wiresDependenciesTo"| U2
    T1 -.-> U2
    T1 -.-> D1
    T2 -.-> U1
    T2 -.-> S2

    %% Click Events
    click U1 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Views"
    click U2 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/ViewModels"
    click U3 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Commands"
    click U4 "https://github.com/singletonsean/reservoom/blob/master/src/Reservoom/Converters/InverseBooleanToVisibilityConverter.cs"
    click D1 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Models"
    click D2 "https://github.com/singletonsean/reservoom/blob/master/src/Reservoom/DTOs/ReservationDTO.cs"
    click DA1 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/DbContexts"
    click DA2 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Migrations"
    click S1 "https://github.com/singletonsean/reservoom/blob/master/src/Reservoom/Services/NavigationService.cs"
    click S2 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Services/ReservationCreators"
    click S3 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Services/ReservationProviders"
    click S4 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Services/ReservationConflictValidators"
    click I1 "https://github.com/singletonsean/reservoom/tree/master/src/Reservoom/Stores"
    click I2 "https://github.com/singletonsean/reservoom/blob/master/src/Reservoom/HostBuilders/AddViewModelsHostBuilderExtensions.cs"
    click T1 "https://github.com/singletonsean/reservoom/blob/master/src/Reservoom.Test"
    click T2 "https://github.com/singletonsean/reservoom/blob/master/src/Reservoom.Test.E2E"

    %% Styles
    classDef ui fill:#b3e5fc,stroke:#01579b,stroke-width:2px;
    classDef domain fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef data fill:#ffecb3,stroke:#f57f17,stroke-width:2px;
    classDef service fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
    classDef infra fill:#d1c4e9,stroke:#673ab7,stroke-width:2px;
    classDef test fill:#f8bbd0,stroke:#c2185b,stroke-width:2px;

    class U1,U2,U3,U4 ui;
    class D1,D2 domain;
    class DA1,DA2 data;
    class S1,S2,S3,S4 service;
    class I1,I2 infra;
    class T1,T2 test;
```
