# azamat753/planner architecture

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

- Interactive diagram: https://gitdiagram.com/azamat753/planner
- Repository: https://github.com/azamat753/planner

## Overview

- User Interface Layer: Represent all UI components such as MainActivity, the various Fragments (e.g., CategoryFragment, CreateEventFragment, CreateIdeaFragment, StopwatchFragment, TimerFragment, etc.), and UI adapters. Also include the App Widget component found in the “ui/widget” directory.
- Data Layer: Show the Room database system, including the TasksDataBase; its DAOs (IdeaDao, TasksDao, TimingDao); and the associated data models (Tasks, Timing). Also, include the repositories (TaskRepository, TimingRepository) that provide an abstraction over direct database access.
- Services: Incorporate the MessageService which represents background operations and likely interacts with the database or UI notifications.
- Utilities and Extensions: Though not a primary “system” component, include a note on the utility classes (in the “utils” package) and extensions that help manage preferences, theming, language settings, and other cross-cutting concerns.
- Assets and Resources: Mark assets (JSON files for calendar, notes, time, and todone) and resource files (layouts, drawables, navigation graphs) as supporting elements that fuel the UI and initialization data.

##### Relationships and Data Flow
- Service module (MessageService) clearly, showing its interactions with both the data layer (if it accesses the Room database) and possibly sends notifications to the UI.

##### Architectural Patterns
- Use of MVVM with clear separation between activities/fragments (view), viewmodels (logic), and repositories/DAOs (data access).
- How the project uses dependency injection (via di modules) to manage component wiring, thereby easing testing and maintainability.
- Room database as a key persistence technology, including its structure (entities, DAOs, repositories).

##### Technology Labels
- Room as the local database technology.
- Frameworks or libraries visible from the files, such as the Android Jetpack components, dependency injection (potentially Koin or Dagger if inferred from the DI modules), and standard Android SDK patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "User Interface Layer"
        MA("MainActivity"):::ui
        CF("CategoryFragment"):::ui
        CEF("CreateEventFragment"):::ui
        CIF("CreateIdeaFragment"):::ui
        SF("StopwatchFragment"):::ui
        TF("TimerFragment"):::ui
        AW("App Widget"):::ui
    end

    %% ViewModel & Business Logic
    subgraph "ViewModel & Business Logic"
        TVM("TaskViewModel"):::business
        TIVM("TimingViewModel"):::business
        TR("TaskRepository"):::business
        TIR("TimingRepository"):::business
        DI("DI Module"):::business
    end

    %% Data Layer
    subgraph "Data Layer"
        RD("Room Database"):::data
        subgraph "DAOs"
            ID("IdeaDao"):::data
            TD("TasksDao"):::data
            TID("TimingDao"):::data
        end
        subgraph "Data Models"
            T("Tasks"):::data
            TIM("Timing"):::data
        end
    end

    %% Services
    subgraph "Services"
        MS("MessageService"):::service
    end

    %% Utilities & Extensions
    subgraph "Utilities & Extensions"
        EXT("Extension.kt"):::util
        SETX("SettingExtensions.kt"):::util
        AUTIL("App.kt"):::util
        BP("BoardPreference.kt"):::util
        LP("LanguagePreference.kt"):::util
        TP("ThemePreference.kt"):::util
        CDT("SimpleCountDownTimer.kt"):::util
    end

    %% Assets & Resources
    subgraph "Assets & Resources"
        CAL("Calendar JSON"):::asset
        NTS("Notes JSON"):::asset
        TM("Time JSON"):::asset
        TDN("Todone JSON"):::asset
        RES("Resource Files"):::asset
    end

    %% Data Flow Connections
    %% UI to ViewModel
    MA -->|"triggers"| TVM
    CF -->|"triggers"| TVM
    CEF -->|"triggers"| TVM
    CIF -->|"triggers"| TVM
    SF -->|"triggers"| TIVM
    TF -->|"triggers"| TIVM

    %% ViewModel to Repository
    TVM -->|"requests"| TR
    TIVM -->|"requests"| TIR

    %% Repository to Room Database
    TR -->|"CRUD"| RD
    TIR -->|"CRUD"| RD

    %% Room Database to DAOs
    RD -->|"provides"| ID
    RD -->|"provides"| TD
    RD -->|"provides"| TID

    %% DI wiring to ViewModel & Repositories
    DI -.-> TVM
    DI -.-> TIVM
    DI -.-> TR
    DI -.-> TIR

    %% Services connections
    MS -->|"accesses"| RD
    MS -->|"notifies"| MA

    %% Assets seeding & Resources connecting to UI
    CAL -->|"seedData"| RD
    NTS -->|"seedData"| RD
    TM -->|"seedData"| RD
    TDN -->|"seedData"| RD
    RES -->|"providesLayout"| MA

    %% Utilities supporting UI and Business Logic
    AUTIL -->|"supports"| MA

    %% Styling Classes
    classDef ui fill:#bbdefb,stroke:#1e88e5,stroke-width:2px;
    classDef business fill:#c8e6c9,stroke:#43a047,stroke-width:2px;
    classDef data fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef service fill:#ffccbc,stroke:#d84315,stroke-width:2px;
    classDef util fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef asset fill:#eceff1,stroke:#607d8b,stroke-width:2px;

    %% Click Events for User Interface Layer
    click MA "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/main/MainActivity.kt"
    click CF "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/main/CategoryFragment.kt"
    click CEF "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/main/CreateEventFragment.kt"
    click CIF "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/main/CreateIdeaFragment.kt"
    click SF "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/main/timing/StopwatchFragment.kt"
    click TF "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/main/timing/TimerFragment.kt"
    click AW "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/ui/widget/AppWidget.kt"

    %% Click Events for Data Layer
    click RD "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/TasksDataBase.kt"
    click ID "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/dao/IdeaDao.kt"
    click TD "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/dao/TasksDao.kt"
    click TID "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/dao/TimingDao.kt"
    click T "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/models/Tasks.kt"
    click TIM "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/models/Timing.kt"
    click TR "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/repositories/TaskRepository.kt"
    click TIR "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/repositories/TimingRepository.kt"

    %% Click Events for ViewModel & DI
    click TVM "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/viewmodels/TaskViewModel.kt"
    click TIVM "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/data/room/viewmodels/TimingViewModel.kt"
    click DI "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/di/viewModelModule.kt"

    %% Click Event for Services
    click MS "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/service/MessageService.kt"

    %% Click Events for Utilities & Extensions
    click EXT "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/extensions/Extension.kt"
    click SETX "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/extensions/SettingExtensions.kt"
    click AUTIL "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/utils/App.kt"
    click BP "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/utils/BoardPreference.kt"
    click LP "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/utils/LanguagePreference.kt"
    click TP "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/utils/ThemePreference.kt"
    click CDT "https://github.com/azamat753/planner/blob/master/app/src/main/java/com/lawlett/planner/utils/SimpleCountDownTimer.kt"

    %% Click Events for Assets & Resources
    click CAL "https://github.com/azamat753/planner/blob/master/app/src/main/assets/calendar.json"
    click NTS "https://github.com/azamat753/planner/blob/master/app/src/main/assets/notes.json"
    click TM "https://github.com/azamat753/planner/blob/master/app/src/main/assets/time.json"
    click TDN "https://github.com/azamat753/planner/blob/master/app/src/main/assets/todone.json"
    click RES "https://github.com/azamat753/planner/tree/master/app/src/main/res"
```
