# ERD Reference (for draw.io / Lucidchart)

## Entities

**Product** (PK: productCode)
- productName, category, quantityInStock, unitPrice, supplierName, dateReceived

**Warehouse** (PK: warehouseCode)
- warehouseName, warehouseLocation

**StockTransaction** (PK: transactionId)
- transactionDate, quantityMoved, transactionType (STOCK_IN | STOCK_OUT)
- FK: productCode → Product
- FK: warehouseCode → Warehouse

## Relationships (Crow's Foot notation)

```
Product (1) --------< (M) StockTransaction
Warehouse (1) ------< (M) StockTransaction
```

- One Product can appear in many StockTransactions.
- One Warehouse can host many StockTransactions.
- Each StockTransaction belongs to exactly one Product and one Warehouse.

## Mermaid diagram (for documentation)

```mermaid
erDiagram
    Product ||--o{ StockTransaction : has
    Warehouse ||--o{ StockTransaction : records
    Product {
        varchar productCode PK
        varchar productName
        varchar category
        int quantityInStock
        decimal unitPrice
        varchar supplierName
        date dateReceived
    }
    Warehouse {
        varchar warehouseCode PK
        varchar warehouseName
        varchar warehouseLocation
    }
    StockTransaction {
        int transactionId PK
        datetime transactionDate
        int quantityMoved
        enum transactionType
        varchar productCode FK
        varchar warehouseCode FK
    }
```
