# titya-yem/atm-simulation architecture

> Architecture diagram of the GitHub repository titya-yem/atm-simulation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/titya-yem/atm-simulation
- Repository: https://github.com/titya-yem/atm-simulation

## Overview

This repository is a console-based ATM simulation. A terminal user chooses to create an account or log in; after login, the main loop dispatches account, deposit, transfer, payment, and receipt screens. The documented domain also includes USD/KHR balances and session-only receipts. SQLite provides persistent account storage. The excerpts show main-loop dispatch and login/database calls; several feature implementations are indexed but unsampled, so their internal calls are not inferred.

Main entry points: [`main.cpp`](https://github.com/titya-yem/atm-simulation/blob/main/main.cpp) (ATM Main Loop), [`config/Database.cpp`](https://github.com/titya-yem/atm-simulation/blob/main/config/Database.cpp) (Database Access), [`utils/Receipt/Receipt.cpp`](https://github.com/titya-yem/atm-simulation/blob/main/utils/Receipt/Receipt.cpp) (Session Receipts), [`utils/Login/Login.cpp`](https://github.com/titya-yem/atm-simulation/blob/main/utils/Login/Login.cpp) (PIN Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["ATM Navigation"]
  node_main_loop["ATM Main Loop<br/>[main.cpp]"]
  node_screen_states["Screen States<br/>[Screen.hpp]"]
end

subgraph group_account["Account Access"]
  node_login["PIN Login<br/>[Login.cpp]"]
  node_create_account["Account Creation<br/>[CreateAccount.cpp]"]
  node_account_info["Account Information<br/>[Account.cpp]"]
end

subgraph group_transactions["ATM Services"]
  node_deposit["Deposits<br/>[Deposit.cpp]"]
  node_transfer["Transfers<br/>[Transfer.cpp]"]
  node_payment["Payments<br/>[Payment.cpp]"]
  node_receipt["Session Receipts<br/>[Receipt.cpp]"]
end

subgraph group_persistence["Persistent Storage"]
  node_database["Database Access<br/>[Database.cpp]"]
  node_sqlite[("SQLite Engine<br/>[sqlite3.c]")]
end

node_terminal_user(("Terminal User"))

node_terminal_user -->|"chooses screens"| node_main_loop
node_main_loop -->|"dispatches login"| node_login
node_main_loop -->|"dispatches creation"| node_create_account
node_main_loop -->|"dispatches account"| node_account_info
node_main_loop -->|"dispatches deposit"| node_deposit
node_main_loop -->|"dispatches transfer"| node_transfer
node_main_loop -->|"dispatches payment"| node_payment
node_main_loop -->|"dispatches receipt"| node_receipt
node_main_loop -->|"tracks navigation"| node_screen_states
node_login -->|"returns state"| node_screen_states
node_login -->|"authenticates account"| node_database
node_account_info -->|"reads account"| node_database
node_create_account -.->|"persists account"| node_database
node_deposit -.->|"records transaction"| node_receipt
node_transfer -.->|"records transaction"| node_receipt
node_payment -.->|"records transaction"| node_receipt
node_database -->|"executes SQL"| node_sqlite

click node_main_loop "https://github.com/titya-yem/atm-simulation/blob/main/main.cpp"
click node_screen_states "https://github.com/titya-yem/atm-simulation/blob/main/Screen/Screen.hpp"
click node_login "https://github.com/titya-yem/atm-simulation/blob/main/utils/Login/Login.cpp"
click node_create_account "https://github.com/titya-yem/atm-simulation/blob/main/utils/CreateAccount/CreateAccount.cpp"
click node_account_info "https://github.com/titya-yem/atm-simulation/blob/main/utils/Account/Account.cpp"
click node_deposit "https://github.com/titya-yem/atm-simulation/blob/main/utils/Deposit/Deposit.cpp"
click node_transfer "https://github.com/titya-yem/atm-simulation/blob/main/utils/Transfer/Transfer.cpp"
click node_payment "https://github.com/titya-yem/atm-simulation/blob/main/utils/Payment/Payment.cpp"
click node_receipt "https://github.com/titya-yem/atm-simulation/blob/main/utils/Receipt/Receipt.cpp"
click node_database "https://github.com/titya-yem/atm-simulation/blob/main/config/Database.cpp"
click node_sqlite "https://github.com/titya-yem/atm-simulation/blob/main/sqlite/sqlite3.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_loop,node_screen_states,node_terminal_user toneBlue
class node_login,node_create_account,node_account_info toneAmber
class node_deposit,node_transfer,node_payment,node_receipt toneMint
class node_database,node_sqlite toneRose
```

## Components

### ATM Navigation

- [ATM Main Loop](https://github.com/titya-yem/atm-simulation/blob/main/main.cpp): `main.cpp`
- [Screen States](https://github.com/titya-yem/atm-simulation/blob/main/Screen/Screen.hpp): `Screen/Screen.hpp`

### Account Access

- [PIN Login](https://github.com/titya-yem/atm-simulation/blob/main/utils/Login/Login.cpp): `utils/Login/Login.cpp`
- [Account Creation](https://github.com/titya-yem/atm-simulation/blob/main/utils/CreateAccount/CreateAccount.cpp): `utils/CreateAccount/CreateAccount.cpp`
- [Account Information](https://github.com/titya-yem/atm-simulation/blob/main/utils/Account/Account.cpp): `utils/Account/Account.cpp`

### ATM Services

- [Deposits](https://github.com/titya-yem/atm-simulation/blob/main/utils/Deposit/Deposit.cpp): `utils/Deposit/Deposit.cpp`
- [Transfers](https://github.com/titya-yem/atm-simulation/blob/main/utils/Transfer/Transfer.cpp): `utils/Transfer/Transfer.cpp`
- [Payments](https://github.com/titya-yem/atm-simulation/blob/main/utils/Payment/Payment.cpp): `utils/Payment/Payment.cpp`
- [Session Receipts](https://github.com/titya-yem/atm-simulation/blob/main/utils/Receipt/Receipt.cpp): `utils/Receipt/Receipt.cpp`

### Persistent Storage

- [Database Access](https://github.com/titya-yem/atm-simulation/blob/main/config/Database.cpp): `config/Database.cpp`
- [SQLite Engine](https://github.com/titya-yem/atm-simulation/blob/main/sqlite/sqlite3.c): `sqlite/sqlite3.c`

### Other components

- **Terminal User**

## Connections

- Terminal User → ATM Main Loop: chooses screens (evidence: `README.md`)
- ATM Main Loop → PIN Login: dispatches login (evidence: `main.cpp`)
- ATM Main Loop → Account Creation: dispatches creation (evidence: `main.cpp`)
- ATM Main Loop → Account Information: dispatches account (evidence: `main.cpp`)
- ATM Main Loop → Deposits: dispatches deposit (evidence: `main.cpp`)
- ATM Main Loop → Transfers: dispatches transfer (evidence: `main.cpp`)
- ATM Main Loop → Payments: dispatches payment (evidence: `main.cpp`)
- ATM Main Loop → Session Receipts: dispatches receipt (evidence: `main.cpp`)
- ATM Main Loop → Screen States: tracks navigation (evidence: `main.cpp`)
- PIN Login → Screen States: returns state (evidence: `utils/Login/Login.cpp`)
- PIN Login → Database Access: authenticates account (evidence: `utils/Login/Login.cpp`)
- Account Information → Database Access: reads account (evidence: `utils/Account/Account.cpp`)
- Account Creation → Database Access: persists account (evidence: `README.md`)
- Deposits → Session Receipts: records transaction
- Transfers → Session Receipts: records transaction
- Payments → Session Receipts: records transaction
- Database Access → SQLite Engine: executes SQL (evidence: `config/Database.cpp`)
