# unlam-tec-movil/a3-2024-h2-e2 architecture

> Architecture diagram of the GitHub repository unlam-tec-movil/a3-2024-h2-e2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unlam-tec-movil/a3-2024-h2-e2
- Repository: https://github.com/unlam-tec-movil/a3-2024-h2-e2

## Overview

##### Main Components
- UI Layer:
- MainActivity: The entry point that sets up the Android “scaffold”, theme, and navigation.
- Screens (located under ui/screens): Containers that orchestrate the visual components.
- Composables/Components (under ui/components): Reusable visual elements.
- Navigation: NavigationApp and NavigationDestination files that use Jetpack Compose Navigation (NavHost, NavController) to switch between screens.
- ViewModels (under ui/viewmodels): Manage UI state and handle user interactions.
- Domain Layer:
- Domain Models: e.g., CategoryModel, ItemModel, ShoppingListModel (representing aggregates or business entities).
- Use Cases/Services: Business logic classes (like CategoryUseCase, ItemUseCases, ShoppingListsUseCases) that encapsulate the application’s behavior.
- Interfaces (ports) defining business operations that the domain relies on.
- Data Layer:
- Repositories: Interfaces and their default implementations for categories, items, and shopping lists (both local and network).
- Local Storage: Data access objects (DAOs) and entities (using Room) – see packages under data/local.
- Network: API services for external communication (like GooglePlaceApi using Retrofit).
- Dependency Injection (DI): Modules (in both data/di and ui/di) that set up the dependencies — ensuring that the adapters (local/network implementations) are injected into the use cases and viewmodels.

##### Relationships and Interactions
- Dependency inversion: UI and Data layers depend on abstract interfaces from the Domain, not on concrete implementations.
- The DI / Service Modules components exist across layers to wire the system together.

##### Architectural Patterns/Design Principles
- Separation of Concerns: Emphasize that the UI layer manages all Android-specific code (activities, navigation, composables) while the Domain remains platform agnostic.
- Dependency Injection: Note the use of DI frameworks (e.g., Hilt or Dagger, as mentioned in the README) to decouple components.

##### Technologies/Frameworks
- Android / Kotlin as the core language and platform.
- Jetpack Compose for building the UI (composables, screens, view models).
- Room as the local persistence solution.
- Retrofit (or related network libraries) for handling API calls.
- Hilt/Dagger for dependency injection.
- Gradle (with build.gradle.kts and wrapper configurations) for building the project.
- Github Workflows for static analysis (ktlint) and test automation.

##### Detailed Capturing of Elements
- Testing infrastructure lightly if desired (e.g., indicating where test packages exist) but focus mainly on the three primary layers alongside the DI infrastructure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer Subgraph
    subgraph "UI Layer"
        direction TB
        MA["MainActivity"]:::ui
        NS["Screens"]:::ui
        CP["Composables/Components"]:::ui
        NV["Navigation"]:::ui
        VM["ViewModels"]:::ui
        UIDI["UI DI"]:::di
    end

    %% Domain Layer Subgraph
    subgraph "Domain Layer"
        direction TB
        DC["Domain: Models & Use Cases"]:::domain
    end

    %% Data Layer Subgraph
    subgraph "Data Layer"
        direction TB
        REP["Repositories"]:::data
        DB["Local Database (Room)"]:::data
        NET["Network (Retrofit)"]:::data
        DIDI["Data DI"]:::di
    end

    %% Global Dependency Injection
    GDI["Global DI"]:::di

    %% UI Layer Internal Connections
    MA -->|"setsUp"| NV
    MA -->|"setsUp"| VM
    MA -->|"initializes"| NS
    MA -->|"provides"| CP

    %% Interaction between UI and Domain
    VM -->|"triggers"| DC

    %% Domain to Data Interaction
    DC -->|"callsPort"| REP

    %% Data internal connections
    REP -->|"accesses"| DB
    REP -->|"accesses"| NET

    %% Dependency Injection wiring
    GDI -->|"wires"| UIDI
    GDI -->|"wires"| DIDI
    UIDI -->|"injects"| VM
    DIDI -->|"injects"| REP

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef domain fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef di fill:#FFA07A,stroke:#000,stroke-width:2px;

    %% Click Events
    click MA "https://github.com/unlam-tec-movil/a3-2024-h2-e2/blob/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/MainActivity.kt"
    click NS "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/ui/screens"
    click CP "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/ui/components"
    click NV "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/ui/navigation"
    click VM "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/ui/viewmodels"
    click DC "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/domain"
    click REP "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/data/repository"
    click DB "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/data/local"
    click NET "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/data/network"
    click DIDI "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/data/di"
    click GDI "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/di"
    click UIDI "https://github.com/unlam-tec-movil/a3-2024-h2-e2/tree/develop/app/src/main/java/ar/edu/unlam/mobile/scaffolding/ui/di"
```
