# TANRAIL ONE — Phase 3 Core Architecture

## 1. The Core Idea

TANRAIL ONE is built on a strictly layered architecture to prevent becoming a tightly coupled, monolithic ERP tailored to a single business.

```text
                    TANRAIL ONE
                         │
                  SHARED CORE
                         │
        ┌────────────────┼────────────────┐
        │                │                │
   Reusable         Reusable         Reusable
 Capabilities      Capabilities      Capabilities
        │                │                │
        └────────────────┼────────────────┘
                         │
              BUSINESS EXTENSIONS
                         │
          ┌──────────────┼──────────────┐
          ↓              ↓              ↓
      Restaurant      Catering       Future
      Extension       Extension      Business
```

The Core remains absolutely **business-agnostic**. It provides universal capabilities that any enterprise needs to operate.

## 2. The Critical Question (The Core Test)

For every proposed capability, we ask:
> "Would this capability still make sense if TANRAIL completely removed Restaurant and Catering and started a completely different business tomorrow?"

If YES: It belongs in Core or Reusable Capability.
If NO: It belongs in a Business Extension.

## 3. Core Capability Map Classification

Based on the critical question, here is the classification of proposed system capabilities:

| Capability | Classification | Why | Used By |
| --- | --- | --- | --- |
| Customer Management | CORE | Every business needs to track who pays them. | All |
| Supplier Management | CORE | Every business buys supplies/services. | All |
| Product/Service Catalog | CORE | Every business sells *something* (items or time). | All |
| Inventory | CORE | Tracking physical assets/stock is universal. | Restaurant, Catering, Water, Transport (Parts) |
| Sales | CORE | Exchanging goods/services for money is universal. | All |
| Orders | CORE | Committing to a transaction before payment. | All |
| Invoicing | CORE | Legal request for payment. | All |
| Payments | CORE | Receiving/sending money. | All |
| Procurement | CORE | The process of acquiring supplies. | All |
| Expenses | CORE | Internal spending tracking. | All |
| Documents | REUSABLE CAPABILITY | Generating PDFs (Invoices, Quotes) is common but varies heavily in format. | Most |
| Notifications | REUSABLE CAPABILITY | Email/SMS sending engine. | All |
| Audit | CORE | System-wide accountability is a technical requirement. | System |
| Reporting | CORE | Aggregating data across Business Units. | Execs, Managers |
| Event Management | REUSABLE CAPABILITY | Scheduling time-bound events. Not all businesses do this. | Catering, Training |
| Fleet/Delivery | REUSABLE CAPABILITY | Managing vehicles/routes. | Catering, Water, Transport |
| Kitchen Display (KDS)| BUSINESS EXTENSION | Strictly related to live food preparation. | Restaurant |
| POS Interface | BUSINESS EXTENSION | High-speed, touchscreen order entry. | Restaurant |

## 4. Architectural Simulations

To prove the validity of the Core, we simulate four distinct business models.

### 4.1 Restaurant Simulation
- **Core usage:** Customer, Product (Food), Order, Inventory (Ingredients), Invoice, Payment.
- **Extension requirements (Outside Core):** Tables, Dine-in vs Takeaway status, Kitchen Display System (KDS), Waiter POS UI, Kitchen Workflow.

### 4.2 Catering Simulation
- **Core usage:** Customer, Product (Packages), Quote/Order, Invoice, Payment, Inventory, Procurement.
- **Reusable usage:** Event Management (Scheduling), Fleet Management (Delivery to venue).
- **Extension requirements:** Tasting Sessions tracking, Per-head tier calculation overrides, Venue logistics constraints.

### 4.3 Water Business Simulation
Pretending TANRAIL starts Water Distribution tomorrow:
- **Core usage:** Customer, Product (20L Bottles, Dispensers), Order, Invoice, Payment, Inventory.
- **Reusable usage:** Fleet Management (Delivery routes).
- **Extension requirements:** Empty Bottle Deposit/Return tracking, Batch quality/PH level logging.

### 4.4 Transport Business Simulation
Pretending TANRAIL starts Transport tomorrow:
- **Core usage:** Customer, Service (Trip/Route fare), Order (Ticket), Invoice, Payment, Expense (Fuel), Procurement (Parts).
- **Reusable usage:** Fleet Management (Vehicles, Drivers, Maintenance).
- **Extension requirements:** Passenger manifests, Seat booking grid, Check-in workflow.

**Conclusion:** The Core effectively supports all four wildly different models without requiring modification. Business-specific logic is entirely isolated into Extensions.
