# TANRAIL ONE — Core Sales Architecture Review

## 1. Scope of Audit
This audit checks the Phase 3.2.3 Core Sales architectural design documents against the Phase 1 & 2 foundational architecture and the Phase 3.2 Inventory Core.

## 2. Contradiction & Alignment Check

### Inventory Integration
- **Potential Contradiction**: Sales deduplicates inventory via `InventoryService`. Does Sales need to know which warehouse to deduct from?
- **Resolution**: An `Order` belongs to a `Branch`. `InventoryService::issue()` requires a specific `InventoryLocation`. If a Branch has multiple Locations (e.g., Main Kitchen, Storage), the Sales Engine must know the exact location to deduct from.
- **Architectural Decision**: `Order` should default to deducting from the Branch's primary Sales location, or `OrderLine` must specify the `inventory_location_id`. *Human Decision Required: Should we add `default_sales_location_id` to the `Branch` model, or force `OrderLine` to carry `inventory_location_id`?*

### Customer Architecture
- **Alignment**: Customers exist at the `Organization` level. Orders exist at the `Branch` (Business Unit) level. This aligns perfectly. A cross-BU customer can place orders in any BU, but the Order itself remains strictly isolated to the BU.

### Pricing and Tax
- **Alignment**: `OrderLine` stores `unit_price` and `tax_amount` physically, completely divorcing historical transactions from future catalog updates. This is mathematically and legally sound.

## 3. Future Expansion Audit
- **Restaurant**: Will create a `TableOrder` model mapping a `Table` to an `Order`. Core engine needs 0 changes.
- **Catering**: Will create an `EventOrder` mapping an `Event` to an `Order`. Core engine needs 0 changes.
- **Water**: Will map a `DeliveryRoute` to an `Order`. Core engine needs 0 changes.

## 4. Required Human Decisions Before Implementation
1. **Inventory Deduction Source**: How does an Order know which specific `InventoryLocation` inside the `Branch` to deduct stock from? (Recommend adding a setting/relation to `Branch` defining the default fulfillment location).
