# aimenux/ibancli architecture

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

- Interactive diagram: https://gitdiagram.com/aimenux/ibancli
- Repository: https://github.com/aimenux/ibancli

## Overview

##### Main Components

A. CLI Interface Layer
- Main Command Handler
- Sub-commands (Generate & Validate)
- Console Service Interface

B. Core Services Layer
- IBAN Service (Generation & Validation Logic)
- Configuration Services
- Logging Services

C. External Dependencies
- Spectre.Console (for CLI UI)
- IBAN.NET Library (for IBAN operations)

**┌─────────────────────────────────────────────────────────┐**
- CLI Interface Layer                   │
- ┌─────────────┐  ┌─────────────┐   ┌──────────────┐   │
- MainCommand  │  │   Generate  │   │   Validate   │   │
- (Entry Point)├─►│   Command   │   │   Command    │   │
- ┘  └──────┬──────┘   └──────┬───────┘   │

- ▼                  ▼           │
- ┌─────────────────────────────┐      │
- Console Service         │      │
- ┬────────────────┘      │
- ┘

**┌────────────────────────────────|────────────────────────┐**
- Core Services Layer                       │
- ▼                        │
- ┌─────────────────────────────┐           │
- IBAN Service          │           │
- (Generation & Validation)   │           │
- ┘           │

- ┘

**┌─────────────────────────────────────────────────────────┐**
- External Dependencies                     │
- ┌───────────────┐              ┌──────────────┐      │
- Spectre.Console│              │   IBAN.NET   │      │
- ┘              └──────────────┘      │
- ┘

##### Important Elements to Highlight

A. Command Pattern Implementation:
- Hierarchy from MainCommand to sub-commands
- AbstractCommand base class relationship

B. Service Layer:
- Separation between IIbanService interface and implementation
- Relationship with the Console Service

C. Configuration and Extensions:
- Configuration flow from appsettings.json
- How logging is integrated

##### Key Relationships

- Command flow from CLI to Services
- Dependency injection paths
- Service interface implementations
- External library integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CLI["CLI Interface Layer"]
        MainCmd["Main Command Handler"]
        GenCmd["Generate Command"]
        ValCmd["Validate Command"]
        AbsCmd["Abstract Command"]
        ConsServ["Console Service"]
        
        MainCmd --> GenCmd
        MainCmd --> ValCmd
        AbsCmd --> GenCmd
        AbsCmd --> ValCmd
        GenCmd --> ConsServ
        ValCmd --> ConsServ
    end

    subgraph Core["Core Services Layer"]
        IbanInt["IBAN Service Interface"]
        IbanImpl["IBAN Service Implementation"]
        Config["Configuration Service"]
        Logging["Logging Service"]
        
        IbanInt --> IbanImpl
        Config --> IbanImpl
        Logging --> IbanImpl
    end

    subgraph Ext["External Dependencies"]
        Spectre["Spectre.Console"]
        IbanNet["IBAN.NET"]
    end

    ConsServ --> IbanInt
    IbanImpl --> IbanNet
    ConsServ --> Spectre

    subgraph Config["Configuration"]
        AppSet["Application Settings"]
    end

    subgraph Test["Testing"]
        IbanTest["IBAN Service Tests"]
    end

    Config --> Core
    IbanTest -.-> IbanImpl

    %% Component Mappings
    click MainCmd "https://github.com/aimenux/IbanCli/blob/main/src/App/Commands/MainCommand.cs"
    click GenCmd "https://github.com/aimenux/IbanCli/blob/main/src/App/Commands/GenerateCommand.cs"
    click ValCmd "https://github.com/aimenux/IbanCli/blob/main/src/App/Commands/ValidateCommand.cs"
    click AbsCmd "https://github.com/aimenux/IbanCli/blob/main/src/App/Commands/AbstractCommand.cs"
    click IbanInt "https://github.com/aimenux/IbanCli/blob/main/src/App/Services/Iban/IIbanService.cs"
    click IbanImpl "https://github.com/aimenux/IbanCli/blob/main/src/App/Services/Iban/IbanService.cs"
    click Config "https://github.com/aimenux/IbanCli/blob/main/src/App/Extensions/ConfigurationBuilderExtensions.cs"
    click Logging "https://github.com/aimenux/IbanCli/blob/main/src/App/Extensions/LoggingBuilderExtensions.cs"
    click ConsServ "https://github.com/aimenux/IbanCli/blob/main/src/App/Services/Console/ConsoleService.cs"
    click AppSet "https://github.com/aimenux/IbanCli/blob/main/src/App/appsettings.json"
    click IbanTest "https://github.com/aimenux/IbanCli/blob/main/test/Tests/IbanServiceTests.cs"

    classDef cli fill:#a2d2ff,stroke:#333,stroke-width:2px
    classDef core fill:#caffbf,stroke:#333,stroke-width:2px
    classDef ext fill:#e9ecef,stroke:#333,stroke-width:2px
    classDef config fill:#ffd6a5,stroke:#333,stroke-width:2px
    classDef test fill:#fdffb6,stroke:#333,stroke-width:2px

    class MainCmd,GenCmd,ValCmd,AbsCmd,ConsServ cli
    class IbanInt,IbanImpl,Config,Logging core
    class Spectre,IbanNet ext
    class AppSet config
    class IbanTest test
```
