# wilson-daniel/assignment architecture

> Architecture diagram of the GitHub repository wilson-daniel/assignment, 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/wilson-daniel/assignment
- Repository: https://github.com/wilson-daniel/assignment

## Overview

##### Main Components
- Android Application Shell:
- AndroidManifest.xml (entry point and configuration details)
- Gradle files (indicate build configurations and dependencies)
- UI Layer (View):
- Composable screens found in the "ui" package (e.g., PokemonListScreen, PokemonDetailScreen)
- Navigation component in AppNavigation.kt for routing between screens (using Navigation Compose)
- ViewModel Layer:
- The ViewModel class (PokemonViewModel.kt) that manages UI-related data.
- Model & Data Layer:
- Data Models: Classes such as Pokemon.kt, PokemonDetail.kt, PokemonList.kt, and PokemonResponse.kt representing the domain.
- Remote Data Source: RetrofitInstance.kt and PokeApiService.kt under the "remote" folder, responsible for making network calls.
- Repository: PokemonRepository.kt that abstracts data gathering (by connecting the ViewModel with the remote data source).
- External Dependencies & Libraries:
- Retrofit and Moshi for network request handling and JSON parsing.
- Coil for image loading.
- Jetpack Compose for UI components, along with Navigation Compose.

- Optionally, include data models that the repository utilizes to parse responses.

##### Architectural Patterns
- That the dependency management takes place at the build configuration level (build.gradle files) and the project leverages a declarative UI paradigm using composables.

- For each component, label them clearly (include file names or package names as appropriate, such as referencing MainActivity, PokemonViewModel, etc.).
- Ancillary elements such as configuration files (AndroidManifest.xml, build.gradle.kts) in a “Configuration/Build” section if needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration & Build Layer
    subgraph "Configuration & Build"
        AM("AndroidManifest.xml"):::config
        Gradle1("build.gradle.kts"):::config
        Gradle2("app/build.gradle.kts"):::config
    end

    %% UI Layer (View)
    subgraph "UI Layer (View)"
        PLS("PokemonListScreen"):::ui
        PDS("PokemonDetailScreen"):::ui
        Nav("AppNavigation"):::ui
    end

    %% ViewModel Layer
    subgraph "ViewModel Layer"
        VM("PokemonViewModel"):::viewmodel
    end

    %% Data Layer (Repository & Model)
    subgraph "Data Layer (Repository & Model)"
        subgraph "Data Models"
            P("Pokemon"):::model
            PD("PokemonDetail"):::model
            PL("PokemonList"):::model
            PR("PokemonResponse"):::model
        end
        subgraph "Remote Data Source"
            PAS("PokeApiService"):::remote
            RI("RetrofitInstance"):::remote
        end
        Repo("PokemonRepository"):::repository
    end

    %% External Service
    API("External PokeAPI"):::external

    %% Connections: Data Flow
    PLS -->|"triggers"| VM
    PDS -->|"triggers"| VM
    Nav -->|"routes_to"| PLS
    Nav -->|"routes_to"| PDS

    VM -->|"calls"| Repo
    Repo -->|"fetches_from"| PAS
    Repo -->|"fetches_from"| RI
    RI -->|"communicates_with"| PAS
    PAS -->|"calls"| API

    API -->|"returns_to"| PAS
    PAS -->|"returns_to"| RI
    RI -->|"returns_to"| Repo
    Repo -->|"updates"| VM
    VM -->|"updates"| PLS
    VM -->|"updates"| PDS

    %% Click Events
    click AM "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/AndroidManifest.xml"
    click Gradle1 "https://github.com/wilson-daniel/assignment/blob/main/build.gradle.kts"
    click Gradle2 "https://github.com/wilson-daniel/assignment/blob/main/app/build.gradle.kts"
    click PLS "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/ui/PokemonListScreen.kt"
    click PDS "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/ui/PokemonDetailScreen.kt"
    click Nav "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/ui/AppNavigation.kt"
    click VM "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/viewmodel/PokemonViewModel.kt"
    click P "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/model/Pokemon.kt"
    click PD "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/model/PokemonDetail.kt"
    click PL "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/model/PokemonList.kt"
    click PR "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/model/PokemonResponse.kt"
    click PAS "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/model/remote/PokeApiService.kt"
    click RI "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/model/remote/RetrofitInstance.kt"
    click Repo "https://github.com/wilson-daniel/assignment/blob/main/app/src/main/java/com/example/mycomposeapplication/data/repository/PokemonRepository.kt"

    %% Styles
    classDef config fill:#f9f,stroke:#333,stroke-width:2px;
    classDef ui fill:#bbf,stroke:#333,stroke-width:2px;
    classDef viewmodel fill:#bfb,stroke:#333,stroke-width:2px;
    classDef model fill:#ffb,stroke:#333,stroke-width:2px;
    classDef remote fill:#fcc,stroke:#333,stroke-width:2px;
    classDef repository fill:#cfc,stroke:#333,stroke-width:2px;
    classDef external fill:#eef,stroke:#333,stroke-width:2px;
```
