---
trigger: always_on
---

# Agent Rule: Building the Shipment Module

When implementing the Shipment Module, adhere to the following planning specifications:

## 🏗️ Data Architecture
- **Primary Model**: `Shipment` (Target File: `app/Models/Market/Shipment.php`)
- **Key Fields**: `hashkey`, `transaction_id`, `store_id`, `customer_id`, `courier_id`, `tracking_number`, `status`.
- **Status Enums**: `PENDING`, `PICKED_UP`, `IN_TRANSIT`, `DELIVERED`, `FAILED`, `RETURNED`.
- **Reference**: Detailed plan at `ai-docs/modules/shipment_module.md`.

## 🛠️ Implementation Requirements
1. **Core Logic**: Implement in `app/Http/Controllers/Market/ShipmentController.php`.
2. **Standard Fields**: Ensure every new table includes `created_by`, `updated_by`, `is_active`, and `hashkey` (300, unique) as per the Project Dictionary.
3. **Frontend**: Use Vue 3 Composition API in `resources/js/Pages/Market/`.
    - `ShipmentList.vue` for tracking.
    - `ShipmentDetail.vue` for timeline and management.

## 📦 Database Standards
Use migrations to create the `shipments` and `couriers` tables, ensuring foreign key constraints to `global_transactions`, `stores`, and `cst`.
