# phutthapornwo-cpu/team-11-inventory architecture

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

- Interactive diagram: https://gitdiagram.com/phutthapornwo-cpu/team-11-inventory
- Repository: https://github.com/phutthapornwo-cpu/team-11-inventory

## Overview

This repository contains a Python inventory-management CLI and a separate modular inventory service. The documented user workflow is to manage items, receive or issue stock, check low-stock levels, and sell products; successful changes are intended to persist immediately to JSON. The excerpts show the modular service’s product, stock, reporting, and notification behavior, plus a separate JSON-backed inventory implementation. README capabilities for physical/digital sales are not visible in sampled source, so those relationships are not inferred.

Main entry points: [`src/service.py`](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/service.py) (Inventory service), [`src/models.py`](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/models.py) (Product and transaction models), [`src/notifiers.py`](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py) (Notifier factory), [`inventory.py`](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/inventory.py) (JSON inventory operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_legacy["JSON inventory"]
  node_json_ops["JSON inventory operations<br/>[inventory.py]"]
  node_json_file[("JSON file")]
end

subgraph group_service["Inventory service"]
  node_service["Inventory service<br/>[service.py]"]
  node_products["Product and transaction models<br/>[models.py]"]
end

subgraph group_alerts["Low stock alerts"]
  node_notifier_protocol["Notifier contract<br/>[notifiers.py]"]
  node_email["Email notifier<br/>[notifiers.py]"]
  node_sms["SMS notifier<br/>[notifiers.py]"]
  node_factory["Notifier factory<br/>[notifiers.py]"]
end

node_user(("CLI user"))
node_cli["Inventory CLI<br/>[inventory.py]"]
node_stock_update["Stock update helper<br/>[update_stock.py]"]
node_physical["Physical product sales"]
node_digital["Digital product sales"]

node_user -->|"runs"| node_cli
node_cli -.->|"uses"| node_json_ops
node_json_ops -->|"loads and saves"| node_json_file
node_stock_update -.->|"returns result"| node_user
node_service -->|"uses models"| node_products
node_service -->|"dispatches alerts"| node_notifier_protocol
node_factory -->|"creates"| node_email
node_factory -->|"creates"| node_sms
node_email -->|"formats product alert"| node_products
node_sms -->|"formats product alert"| node_products
node_physical -.->|"supported by README"| node_service
node_digital -.->|"supported by README"| node_service

click node_cli "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/inventory.py"
click node_json_ops "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/inventory.py"
click node_stock_update "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/update_stock.py"
click node_service "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/service.py"
click node_products "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/models.py"
click node_notifier_protocol "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py"
click node_email "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py"
click node_sms "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py"
click node_factory "https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py"

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_json_ops,node_json_file,node_user toneBlue
class node_service,node_products toneAmber
class node_notifier_protocol,node_email,node_sms,node_factory toneMint
class node_cli,node_stock_update toneTeal
class node_physical,node_digital toneIndigo
```

## Components

### JSON inventory

- [JSON inventory operations](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/inventory.py): `inventory.py`
- **JSON file**

### Inventory service

- [Inventory service](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/service.py): `src/service.py`
- [Product and transaction models](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/models.py): `src/models.py`

### Low stock alerts

- [Notifier contract](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py): `src/notifiers.py`
- [Email notifier](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py): `src/notifiers.py`
- [SMS notifier](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py): `src/notifiers.py`
- [Notifier factory](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/src/notifiers.py): `src/notifiers.py`

### Other components

- **CLI user**
- [Inventory CLI](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/inventory.py): `inventory.py`
- [Stock update helper](https://github.com/phutthapornwo-cpu/team-11-inventory/blob/main/update_stock.py): `update_stock.py`
- **Physical product sales**
- **Digital product sales**

## Connections

- CLI user → Inventory CLI: runs (evidence: `README.md`)
- Inventory CLI → JSON inventory operations: uses (evidence: `inventory.py`)
- JSON inventory operations → JSON file: loads and saves (evidence: `inventory.py`)
- Stock update helper → CLI user: returns result
- Inventory service → Product and transaction models: uses models (evidence: `src/service.py`)
- Inventory service → Notifier contract: dispatches alerts (evidence: `src/service.py`)
- Notifier factory → Email notifier: creates (evidence: `src/notifiers.py`)
- Notifier factory → SMS notifier: creates (evidence: `src/notifiers.py`)
- Email notifier → Product and transaction models: formats product alert (evidence: `src/notifiers.py`)
- SMS notifier → Product and transaction models: formats product alert (evidence: `src/notifiers.py`)
- Physical product sales → Inventory service: supported by README (evidence: `README.md`)
- Digital product sales → Inventory service: supported by README (evidence: `README.md`)
