# haberleslucas/vaca-manager-app architecture

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

- Interactive diagram: https://gitdiagram.com/haberleslucas/vaca-manager-app
- Repository: https://github.com/haberleslucas/vaca-manager-app

## Overview

##### Main Components
- Android Application Layer: Represent the app as the core component that runs on Android devices.
- UI/Presentation: Include the various Activities and layouts (for example, MainActivity, activities like activity_lista_de_vacas, activity_aniadir_vaca, etc.). Note that many XML layout files and drawable resources are present, which govern the look-and-feel.
- Business Logic: Include the Kotlin classes that house the core functionality – these include controllers or classes like ConexionDB, SQLite (database access), and model classes (VacaModel, NuevoModelVaca, etc.). Also notice specialized classes for operations like sorting (OrdenadorDeVacas) and adapter classes for list presentations (VacaAdapter, NuevoVacaAdapter).
- Data Persistence: Highlight the SQLite database management component. Connection and query operations are encapsulated (here, via the SQLite.kt file, ConexionDB.kt, etc.).
- Build/Configuration Tools: While not an architectural runtime component, it’s useful to note that the Gradle build scripts and related configuration (build.gradle, gradle wrapper, etc.) ensure proper assembly and deployment.

##### Relationships and Interactions
- UI components interact with the Business Logic: The Activities (like MainActivity, ListaDeVacas, etc.) call functions in the model or controller classes to retrieve or update cattle records.

##### Architectural Patterns
- MVC/MVVM-like Separation: Even if the project doesn’t declare a formal design pattern, its division between UI (Activities and XML layouts), business logic (Kotlin classes managing data), and a dedicated data persistence layer (SQLite) suggests a separation of concerns.
- Modularization by Files and Directories: The clear separation between interface files (res folder), business logic (src/main/java/com/haberleslucas/asistenciadevacas), and tests (androidTest, test) also reflects solid project organization.

##### Relevant Technologies and Frameworks
- Android/Kotlin: The core of the project.
- SQLite: Used for local data management.
- Gradle: For build and dependency management.
- Android Resource System: XML layouts, drawables, and other resources for UI rendering.

##### Specific Elements
- Clear Labels for Each Component: Label nodes as “UI – Activities/Layouts”, “Business Logic – Controllers/Services”, “Data Persistence – SQLite”, and “Build/Configuration” if needed.
- UI Components (e.g., rectangles)
- Business Logic/Middleware (e.g., hexagons or rounded rectangles)

## Diagram (Mermaid)

```mermaid
flowchart TD
    AA["Android Application Layer"]:::app
    subgraph UI [UI - Presentation]
        U1["MainActivity"]:::ui
        U2["ListaDeVacas"]:::ui
        U3["AniadirVaca"]:::ui
        U4["DetalleVaca"]:::ui
        U5["ListaDeVacasAsistidas"]:::ui
        U6["Layouts & Resources"]:::ui
    end
    subgraph BL [Business Logic]
        BL1["ConexionDB"]:::logic
        BL2["SQLite"]:::logic
        BL3["VacaModel"]:::logic
        BL4["NuevoModelVaca"]:::logic
        BL5["OrdenadorDeVacas"]:::logic
        BL6["VacaAdapter"]:::logic
        BL7["NuevoVacaAdapter"]:::logic
        BL8["ColoresUbicaciones"]:::logic
        BL9["Item_lista_vaca"]:::logic
    end
    subgraph DP [Data Persistence]
        DP1["SQLite Database"]:::data
    end
    subgraph BT [Build/Configuration]
        BT1["Gradle Build Scripts"]:::build
    end
    subgraph LEGEND [Legend]
        L1["UI: Activities/Layouts"]:::ui
        L2["Logic: Controllers/Adapters/Models"]:::logic
        L3["Data: SQLite Database"]:::data
        L4["Build: Gradle Build Scripts"]:::build
        L5["App: Android Application Layer"]:::app
    end

    AA --> U1
    AA --> U2
    AA --> U3
    AA --> U4
    AA --> U5
    AA --> U6
    AA --> BL
    AA --> DP

    U1 -->|"calls"| BL1
    U1 -->|"calls"| BL2
    U2 -->|"triggers"| BL3
    U3 -->|"triggers"| BL4
    U4 -->|"requests"| BL5
    U5 -->|"displays"| BL6
    U6 -->|"renders"| U1

    BL1 -->|"utilizes"| DP1
    BL2 -->|"executes"| DP1
    BL3 -->|"manages"| DP1
    BL4 -->|"manages"| DP1
    BL5 -->|"orders"| DP1

    BT1 -->|"builds"| AA

    click AA "https://github.com/haberleslucas/vaca-manager-app/tree/main/app/src/main/java/com/haberleslucas/asistenciadevacas"
    click U1 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/MainActivity.kt"
    click U2 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/ListaDeVacas.kt"
    click U3 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/AniadirVaca.kt"
    click U4 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/DetalleVaca.kt"
    click U5 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/ListaDeVacasAsistidas.kt"
    click U6 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/res/layout/activity_main.xml"
    click BL1 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/ConexionDB.kt"
    click BL2 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/SQLite.kt"
    click BL3 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/VacaModel.kt"
    click BL4 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/NuevoModelVaca.kt"
    click BL5 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/OrdenadorDeVacas.kt"
    click BL6 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/VacaAdapter.kt"
    click BL7 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/NuevoVacaAdapter.kt"
    click BL8 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/ColoresUbicaciones.kt"
    click BL9 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/src/main/java/com/haberleslucas/asistenciadevacas/Item_lista_vaca.kt"
    click BT1 "https://github.com/haberleslucas/vaca-manager-app/blob/main/app/build.gradle"

    classDef ui fill:#ADD8E6,stroke:#0000FF,stroke-width:2px;
    classDef logic fill:#90EE90,stroke:#008000,stroke-width:2px;
    classDef data fill:#D3D3D3,stroke:#A9A9A9,stroke-width:2px;
    classDef build fill:#F08080,stroke:#CD5C5C,stroke-width:2px;
    classDef app fill:#FFFACD,stroke:#DAA520,stroke-width:2px;
```
