# hadao12/count-doku architecture

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

- Interactive diagram: https://gitdiagram.com/hadao12/count-doku
- Repository: https://github.com/hadao12/count-doku

## Overview

##### Main Architecture Components

a) Presentation Layer (Top)
- Screens (Splash, Level, Puzzle, Pass)
- Jetpack Compose UI components
- ViewModels for each screen
- UI State, Events, and Actions flow

b) Domain Layer (Middle)
- UseCase components (e.g., GenerateQuestionsUseCase)
- Domain models (Puzzle, GameLevel)

c) Data Layer (Bottom)
- Local Database (SQLite)
- DAOs (GameMetaDataDao, LevelDao)
- PlayerProgressManager for preferences

##### Component Relationships

- ViewModels → UseCases (downward)
- UseCases → Repositories (downward)
- DAOs → Database (bidirectional)
- Database → Domain Models (upward)

b) Dependency Injection:
- AppModule as a central component

##### Specific Components

Frontend:
**[Presentation Layer]**
- Screens (Compose UI)
- SplashScreen
- LevelScreen
- PuzzleScreen
- PassScreen
- ViewModels
- LevelViewModel
- PuzzleViewModel
- PassViewModel
- UI Components
- Custom Components
- CustomProgressBar
- PuzzleButton
- PuzzleTopAppBar

Backend:
**[Domain Layer]**
- UseCases
- GenerateQuestionsUseCase
- Models
- GameLevel
- Puzzle

**[Data Layer]**
- Local Database
- DatabaseHelper
- DAOs
- GameMetaDataDao
- LevelDao
- Preferences
- PlayerProgressManager

##### Additional Elements

Include:
- Version information
- Technology stack badges (Kotlin, Jetpack Compose, SQLite)
- Clear data flow indicators
- State management flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef viewmodel fill:#2ecc71,stroke:#27ae60,color:white
    classDef usecase fill:#f1c40f,stroke:#f39c12,color:black
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef model fill:#9b59b6,stroke:#8e44ad,color:white
    classDef utility fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Presentation Layer
    subgraph Presentation
        %% Screens
        SplashScreen["Splash Screen"]:::ui
        LevelScreen["Level Screen"]:::ui
        PuzzleScreen["Puzzle Screen"]:::ui
        PassScreen["Pass Screen"]:::ui

        %% ViewModels
        LevelVM["Level ViewModel"]:::viewmodel
        PuzzleVM["Puzzle ViewModel"]:::viewmodel
        PassVM["Pass ViewModel"]:::viewmodel

        %% UI Components
        subgraph UIComponents
            ProgressBar["Custom Progress Bar"]:::ui
            PuzzleBtn["Puzzle Button"]:::ui
            TopAppBar["Puzzle Top App Bar"]:::ui
        end
    end

    %% Domain Layer
    subgraph Domain
        GenQuestions["Generate Questions UseCase"]:::usecase
        GameLevel["Game Level"]:::model
        PuzzleModel["Puzzle"]:::model
    end

    %% Data Layer
    subgraph Data
        DBHelper["Database Helper"]:::data
        GameMetaDao["Game Meta Data DAO"]:::data
        LevelDao["Level DAO"]:::data
        ProgressMgr["Player Progress Manager"]:::data
    end

    %% Dependency Injection
    AppModule["App Module"]:::utility

    %% Relationships
    LevelScreen --> LevelVM
    PuzzleScreen --> PuzzleVM
    PassScreen --> PassVM

    LevelVM --> GenQuestions
    PuzzleVM --> GenQuestions
    PassVM --> GenQuestions

    GenQuestions --> GameLevel
    GenQuestions --> PuzzleModel

    GameMetaDao --> DBHelper
    LevelDao --> DBHelper
    DBHelper --> GameLevel
    DBHelper --> PuzzleModel

    AppModule -.-> LevelVM
    AppModule -.-> PuzzleVM
    AppModule -.-> PassVM
    AppModule -.-> DBHelper
    AppModule -.-> ProgressMgr

    %% Click Events
    click SplashScreen "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/splash/SplashScreen.kt"
    click LevelScreen "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/level/LevelScreen.kt"
    click PuzzleScreen "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/puzzle/PuzzleScreen.kt"
    click PassScreen "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/pass/PassScreen.kt"
    click LevelVM "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/level/LevelViewModel.kt"
    click PuzzleVM "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/puzzle/PuzzleViewModel.kt"
    click PassVM "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/pass/PassViewModel.kt"
    click ProgressBar "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/puzzle/component/CustomProgressBar.kt"
    click PuzzleBtn "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/puzzle/component/PuzzleButton.kt"
    click TopAppBar "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/presentation/puzzle/component/PuzzleTopAppBar.kt"
    click GenQuestions "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/domain/usecase/GenerateQuestionsUseCase.kt"
    click GameLevel "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/models/GameLevel.kt"
    click PuzzleModel "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/models/Puzzle.kt"
    click DBHelper "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/data/local/DatabaseHelper.kt"
    click GameMetaDao "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/data/local/dao/GameMetaDataDao.kt"
    click LevelDao "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/data/local/dao/LevelDao.kt"
    click ProgressMgr "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/data/preferences/PlayerProgressManager.kt"
    click AppModule "https://github.com/hadao12/count-doku/blob/main/app/src/main/java/com/coda/countdoku/core/di/AppModule.kt"
```
