# peisosimone/loadshedding architecture

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

- Interactive diagram: https://gitdiagram.com/peisosimone/loadshedding
- Repository: https://github.com/peisosimone/loadshedding

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Presentation Layer (MAUI UI Components):
- Main UI (MainPage.xaml)
- Custom Controls (CircularProgressBarControl)
- Platform-Specific Implementations (iOS, Android, Windows, MacCatalyst)

b) Service Layer:
- Load Shedding Services
- Weather Services
- Calendar Services
- Alert Services

c) External APIs:
- Eskom Calendar API
- OpenWeatherMap API
- Syncfusion Components

##### Architecture Pattern
The project follows a clean architecture pattern with:
- Clear separation of concerns (Services, Interfaces, Models)
- Dependency injection (visible in MauiProgram.cs)
- Interface-based design (IServices in Interfaces folder)

**[UI Layer]**
- ↑↓
**[Service Layer]**
- ↑↓
**[External Services]**

##### Important Elements
- Configuration components (ApiKeysConfiguration, SupabaseConfiguration)
- Resource management (Resources folder structure)
- Platform-specific implementations
- Cross-cutting concerns (AlertServices)

##### Clean separation of concerns

Keep the abstraction level focused on the architectural components while showing the cross-platform nature of the MAUI application. This will help developers understand both the overall structure and the platform-specific implementations.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "UI Layer"
        MainUI["Main UI"]
        CustomControls["Custom Controls"]
        AppEntry["App Entry Point"]
        
        subgraph "Platform Specific"
            iOS["iOS Implementation"]
            Android["Android Implementation"]
            Windows["Windows Implementation"]
            MacCatalyst["MacCatalyst Implementation"]
        end
        
        Resources["Resources & Styling"]
    end
    
    subgraph "Service Layer"
        MauiProgram["MAUI Program"]
        
        subgraph "Core Services"
            LoadShedding["Load Shedding Service"]
            Weather["Weather Service"]
            Calendar["Calendar Service"]
            Alert["Alert Service"]
            CalendarSearch["Calendar Search"]
        end
        
        subgraph "Interfaces"
            ServiceInterfaces["Service Interfaces"]
        end
        
        subgraph "Models"
            ConfigModels["Configuration Models"]
            WeatherModel["Weather Model"]
            ScheduleModel["Schedule Model"]
            StatusModel["Status Model"]
        end
    end
    
    subgraph "External Services"
        EskomAPI["Eskom Calendar API"]
        WeatherAPI["OpenWeatherMap API"]
        SyncFusion["Syncfusion Components"]
    end
    
    %% Relationships
    MainUI --> CustomControls
    MainUI --> Resources
    AppEntry --> MauiProgram
    
    LoadShedding --> ServiceInterfaces
    Weather --> ServiceInterfaces
    Calendar --> ServiceInterfaces
    Alert --> ServiceInterfaces
    CalendarSearch --> ServiceInterfaces
    
    LoadShedding --> EskomAPI
    Weather --> WeatherAPI
    Calendar --> EskomAPI
    
    LoadShedding --> StatusModel
    Weather --> WeatherModel
    Calendar --> ScheduleModel
    
    MauiProgram --> ConfigModels
    
    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white
    
    class MainUI,CustomControls,Resources,iOS,Android,Windows,MacCatalyst,AppEntry ui
    class LoadShedding,Weather,Calendar,Alert,CalendarSearch,ServiceInterfaces,MauiProgram service
    class EskomAPI,WeatherAPI,SyncFusion external
    class ConfigModels,WeatherModel,ScheduleModel,StatusModel config
    
    %% Click Events
    click MainUI "https://github.com/PeisoSimone/LoadShedding/blob/master/MainPage.xaml/MainPage.xaml.cs"
    click CustomControls "https://github.com/PeisoSimone/LoadShedding/blob/master/CustomControl/CircularProgressBarControl.xaml"
    click LoadShedding "https://github.com/PeisoSimone/LoadShedding/blob/master/Services/LoadSheddingStatusServices.cs"
    click Weather "https://github.com/PeisoSimone/LoadShedding/blob/master/Services/WeatherServices.cs"
    click Calendar "https://github.com/PeisoSimone/LoadShedding/blob/master/Services/CalenderServices.cs"
    click Alert "https://github.com/PeisoSimone/LoadShedding/blob/master/Services/AlertServices.cs"
    click ServiceInterfaces "https://github.com/PeisoSimone/LoadShedding/tree/master/Interfaces/"
    click ConfigModels "https://github.com/PeisoSimone/LoadShedding/tree/master/Models/"
    click iOS "https://github.com/PeisoSimone/LoadShedding/tree/master/Platforms/iOS"
    click Android "https://github.com/PeisoSimone/LoadShedding/tree/master/Platforms/Android"
    click Windows "https://github.com/PeisoSimone/LoadShedding/tree/master/Platforms/Windows"
    click MacCatalyst "https://github.com/PeisoSimone/LoadShedding/tree/master/Platforms/MacCatalyst"
    click Resources "https://github.com/PeisoSimone/LoadShedding/tree/master/Resources/"
    click MauiProgram "https://github.com/PeisoSimone/LoadShedding/blob/master/MauiProgram.cs"
    click AppEntry "https://github.com/PeisoSimone/LoadShedding/blob/master/App.xaml/App.xaml.cs"
    click CalendarSearch "https://github.com/PeisoSimone/LoadShedding/blob/master/Services/CalendarSearchServices.cs"
    click WeatherModel "https://github.com/PeisoSimone/LoadShedding/blob/master/Models/WeatherRoot.cs"
    click ScheduleModel "https://github.com/PeisoSimone/LoadShedding/blob/master/Models/ScheduleRoot.cs"
    click StatusModel "https://github.com/PeisoSimone/LoadShedding/blob/master/Models/StatusRoot.cs"
```
