# j-a-1979/pokemonselector architecture

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

- Interactive diagram: https://gitdiagram.com/j-a-1979/pokemonselector
- Repository: https://github.com/j-a-1979/pokemonselector

## Overview

##### Project Type and Purpose
- This is a single‐executable, console‐based C# (.NET) application.
- Purpose: let the user select one of three starter Pokémon via a text menu. Utilizes OOP to model Pokémon, handles user input, and renders ASCII art.

##### File Structure Analysis
- Top‐level files:
- Program.cs – contains Main(), menu loop, input handling, orchestration.
- Class.cs – defines the Pokémon class (properties: Name, Level, Type; possibly ASCII art).
- pokemonSelector.csproj – project configuration.

##### Key Architectural Components
a. Presentation Layer (Console UI)
– Module: InputHandler / MenuLoop (in Program.cs)
– Responsibilities: Display menu, read user input, normalize/case‐ignore comparison.
b. Domain Model
– Pokémon class (in Class.cs)
– Holds data: Name, Level, Type, ASCIIArt.
c. Application Logic / Service Layer
– SelectionService (logic inside Program.cs or a separate class):
- Validates user input against list of Pokémon objects
- Retrieves selected Pokémon instance
– AsciiArtRenderer: fetches and prints ASCII art for the selected Pokémon
d. Data Store (In‐memory Repository)
– Hardcoded list/array of Pokémon objects instantiated at startup.
– Represents a trivial “repository” containing all possible choices.

##### Relationships & Data Flow
- User → Console UI: types “1” or “Pikachu”
- Console UI → SelectionService: passes raw input
- SelectionService → Pokémon Repository: looks up matching Pokémon object
- If found → AsciiArtRenderer: retrieves ASCII string
- AsciiArtRenderer → Console UI: prints confirmation, description, and ASCII art
- Loop returns to Console UI for next input

##### Architectural Patterns & Principles
- Layered Pattern: separation of Presentation, Domain, and Service logic (even in a tiny app).
- Single Responsibility Principle: keep Pokémon model separate from input/output and selection logic.
- Inversion of Control (lightweight): main orchestrator (Program.cs) wires together handlers and models.

1. Console UI
2. SelectionService
3. Pokémon Repository (in‐memory array)
4. Pokémon Class (Domain Model)
5. AsciiArtRenderer
- UI → SelectionService (raw input)
- SelectionService → Repository (Lookup by name/ID)
- Repository → SelectionService (Pokémon object)
- SelectionService → AsciiArtRenderer (Pokémon object)
- AsciiArtRenderer → Console UI (ASCII art + description)
c. Technology Annotations:
- .NET 9.0 (runtime)
- C# Console Application
- Small note on Program.cs as the composition root

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        ConsoleUI["Console UI"]:::presentation
    end

    %% Service Layer
    subgraph "Service Layer"
        SelectionService["SelectionService"]:::service
        AsciiArtRenderer["AsciiArtRenderer"]:::service
    end

    %% Domain Model
    subgraph "Domain Model"
        PokemonClass["Pokémon Class"]:::domain
    end

    %% Repository
    PokemonRepository[(Pokémon Repository)]:::repo

    %% Project Files
    subgraph "Project Files"
        Config["pokemonSelector.csproj"]:::config
        README["README.md"]:::config
    end

    %% Data Flow
    User((User)) -->|"keyboard input"| ConsoleUI
    ConsoleUI -->|"raw input"| SelectionService
    SelectionService -->|"lookup request"| PokemonRepository
    PokemonRepository -->|"Pokémon object"| SelectionService
    SelectionService -->|"Pokémon object"| AsciiArtRenderer
    AsciiArtRenderer -->|"ASCII art & description"| ConsoleUI

    %% Click Events
    click ConsoleUI "https://github.com/j-a-1979/pokemonselector/blob/main/Program.cs"
    click SelectionService "https://github.com/j-a-1979/pokemonselector/blob/main/Program.cs"
    click PokemonRepository "https://github.com/j-a-1979/pokemonselector/blob/main/Program.cs"
    click AsciiArtRenderer "https://github.com/j-a-1979/pokemonselector/blob/main/Program.cs"
    click PokemonClass "https://github.com/j-a-1979/pokemonselector/blob/main/Class.cs"
    click Config "https://github.com/j-a-1979/pokemonselector/blob/main/pokemonSelector.csproj"
    click README "https://github.com/j-a-1979/pokemonselector/blob/main/README.md"

    %% Styles
    classDef presentation fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef service fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef domain fill:#FFFFFF,stroke:#333,stroke-width:1px;
    classDef repo fill:#90EE90,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef config fill:#FFEFD5,stroke:#333,stroke-width:1px;
```
