# Carzz Database Table Dictionary

All tables include `id BIGINT UNSIGNED PRIMARY KEY`, `created_at`, `updated_at`. FK columns use unsigned BIGINT. Currency amounts are `DECIMAL(14,2)`.

## 01 System

### `users`

| Column | Definition |
|---|---|
| `name` | `string` |
| `email` | `string` nullable |
| `phone` | `string` nullable |
| `password` | `string` nullable |
| `status` | `string` |
| `email_verified_at` | `datetime` nullable |
| `phone_verified_at` | `datetime` nullable |
| `remember_token` | `string` nullable |

### `user_profiles`

| Column | Definition |
|---|---|
| `user_id` | `FK → users` |
| `full_name` | `string` nullable |
| `date_of_birth` | `date` nullable |
| `gender` | `string` nullable |
| `nid_number` | `string` nullable |
| `emergency_phone` | `string` nullable |

### `roles`

| Column | Definition |
|---|---|
| `name` | `string` |
| `guard_name` | `string` |

### `permissions`

| Column | Definition |
|---|---|
| `name` | `string` |
| `guard_name` | `string` |

### `model_has_roles`

| Column | Definition |
|---|---|
| `role_id` | `FK → roles` |
| `model_type` | `string` |
| `model_id` | `bigint` |

### `model_has_permissions`

| Column | Definition |
|---|---|
| `permission_id` | `FK → permissions` |
| `model_type` | `string` |
| `model_id` | `bigint` |

### `role_has_permissions`

| Column | Definition |
|---|---|
| `role_id` | `FK → roles` |
| `permission_id` | `FK → permissions` |

### `branches`

| Column | Definition |
|---|---|
| `name` | `string` |
| `code` | `string` |
| `address` | `text` nullable |
| `phone` | `string` nullable |
| `status` | `string` |

### `system_settings`

| Column | Definition |
|---|---|
| `key` | `string` |
| `value` | `text` nullable |
| `group_name` | `string` nullable |
| `is_public` | `boolean` |

### `number_sequences`

| Column | Definition |
|---|---|
| `key` | `string` |
| `prefix` | `string` nullable |
| `next_number` | `bigint` |
| `padding` | `integer` |

### `activity_logs`

| Column | Definition |
|---|---|
| `user_id` | `FK → users` nullable |
| `event` | `string` |
| `subject_type` | `string` nullable |
| `subject_id` | `bigint` nullable |
| `properties` | `json` nullable |
| `ip_address` | `string` nullable |

## 02 Fleet

### `vehicle_brands`

| Column | Definition |
|---|---|
| `name` | `string` |
| `slug` | `string` |
| `status` | `string` |

### `vehicle_models`

| Column | Definition |
|---|---|
| `brand_id` | `FK → vehicle_brands` |
| `name` | `string` |
| `slug` | `string` |
| `status` | `string` |

### `vehicle_categories`

| Column | Definition |
|---|---|
| `name` | `string` |
| `slug` | `string` |
| `description` | `text` nullable |
| `status` | `string` |

### `vehicles`

| Column | Definition |
|---|---|
| `fleet_number` | `string` |
| `registration_number` | `string` |
| `brand_id` | `FK → vehicle_brands` |
| `model_id` | `FK → vehicle_models` |
| `category_id` | `FK → vehicle_categories` |
| `model_year` | `integer` nullable |
| `color` | `string` nullable |
| `fuel_type` | `string` nullable |
| `transmission` | `string` nullable |
| `seat_capacity` | `integer` nullable |
| `luggage_capacity` | `integer` nullable |
| `ownership_type` | `string` |
| `operational_status` | `string` |
| `current_branch_id` | `FK → branches` nullable |
| `title` | `string` nullable |
| `description` | `text` nullable |

### `vehicle_images`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `file_path` | `string` |
| `is_primary` | `boolean` |
| `sort_order` | `integer` |

### `vehicle_features`

| Column | Definition |
|---|---|
| `name` | `string` |
| `icon` | `string` nullable |
| `status` | `string` |

### `vehicle_feature`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `feature_id` | `FK → vehicle_features` |

### `vehicle_documents`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `document_type` | `string` |
| `document_number` | `string` nullable |
| `file_path` | `string` nullable |
| `issued_at` | `date` nullable |
| `expires_at` | `date` nullable |
| `verification_status` | `string` |

### `vehicle_ownerships`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `supplier_id` | `FK → suppliers` nullable |
| `ownership_type` | `string` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |
| `notes` | `text` nullable |

### `vehicle_availability_blocks`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `start_at` | `datetime` |
| `end_at` | `datetime` |
| `reason` | `string` |
| `reference_type` | `string` nullable |
| `reference_id` | `bigint` nullable |

### `vehicle_maintenance`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `maintenance_type` | `string` |
| `started_at` | `datetime` |
| `completed_at` | `datetime` nullable |
| `cost` | `money` nullable |
| `notes` | `text` nullable |

### `vehicle_expenses`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `expense_date` | `date` |
| `expense_type` | `string` |
| `amount` | `money` |
| `notes` | `text` nullable |

### `vehicle_odometer_logs`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `recorded_at` | `datetime` |
| `odometer` | `decimal` nullable |
| `source` | `string` nullable |
| `notes` | `text` nullable |

## 03 Supplier

### `suppliers`

| Column | Definition |
|---|---|
| `supplier_code` | `string` |
| `name` | `string` |
| `phone` | `string` nullable |
| `email` | `string` nullable |
| `address` | `text` nullable |
| `supplier_type` | `string` |
| `status` | `string` |

### `supplier_contacts`

| Column | Definition |
|---|---|
| `supplier_id` | `FK → suppliers` |
| `name` | `string` |
| `designation` | `string` nullable |
| `phone` | `string` nullable |
| `email` | `string` nullable |

### `supplier_bank_accounts`

| Column | Definition |
|---|---|
| `supplier_id` | `FK → suppliers` |
| `bank_name` | `string` nullable |
| `account_name` | `string` nullable |
| `account_number` | `string` nullable |
| `branch_name` | `string` nullable |
| `mobile_wallet` | `string` nullable |
| `is_default` | `boolean` |

### `vehicle_lease_agreements`

| Column | Definition |
|---|---|
| `supplier_id` | `FK → suppliers` |
| `agreement_number` | `string` |
| `start_date` | `date` |
| `end_date` | `date` nullable |
| `billing_cycle` | `string` |
| `payment_due_day` | `integer` nullable |
| `security_deposit` | `money` |
| `status` | `string` |
| `terms_conditions` | `text` nullable |

### `vehicle_lease_items`

| Column | Definition |
|---|---|
| `agreement_id` | `FK → vehicle_lease_agreements` |
| `vehicle_id` | `FK → vehicles` |
| `monthly_rent` | `money` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |
| `maintenance_responsibility` | `string` |
| `driver_included` | `boolean` |
| `status` | `string` |

### `vehicle_lease_rate_histories`

| Column | Definition |
|---|---|
| `lease_item_id` | `FK → vehicle_lease_items` |
| `monthly_rent` | `money` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |
| `reason` | `text` nullable |

### `supplier_bills`

| Column | Definition |
|---|---|
| `supplier_id` | `FK → suppliers` |
| `agreement_id` | `FK → vehicle_lease_agreements` nullable |
| `bill_number` | `string` |
| `period_start` | `date` |
| `period_end` | `date` |
| `due_date` | `date` nullable |
| `subtotal` | `money` |
| `adjustment_total` | `money` |
| `total_amount` | `money` |
| `status` | `string` |

### `supplier_bill_items`

| Column | Definition |
|---|---|
| `supplier_bill_id` | `FK → supplier_bills` |
| `lease_item_id` | `FK → vehicle_lease_items` nullable |
| `description` | `string` |
| `amount` | `money` |

### `supplier_payments`

| Column | Definition |
|---|---|
| `supplier_id` | `FK → suppliers` |
| `payment_number` | `string` |
| `payment_date` | `date` |
| `amount` | `money` |
| `method` | `string` |
| `reference` | `string` nullable |
| `notes` | `text` nullable |

### `supplier_payment_allocations`

| Column | Definition |
|---|---|
| `supplier_payment_id` | `FK → supplier_payments` |
| `supplier_bill_id` | `FK → supplier_bills` |
| `amount` | `money` |

### `supplier_adjustments`

| Column | Definition |
|---|---|
| `supplier_id` | `FK → suppliers` |
| `agreement_id` | `FK → vehicle_lease_agreements` nullable |
| `adjustment_date` | `date` |
| `adjustment_type` | `string` |
| `amount` | `money` |
| `reason` | `text` nullable |

## 04 Customers

### `customers`

| Column | Definition |
|---|---|
| `user_id` | `FK → users` nullable |
| `customer_code` | `string` |
| `name` | `string` |
| `phone` | `string` nullable |
| `email` | `string` nullable |
| `address` | `text` nullable |
| `status` | `string` |

### `corporate_accounts`

| Column | Definition |
|---|---|
| `account_code` | `string` |
| `company_name` | `string` |
| `account_type` | `string` |
| `billing_email` | `string` nullable |
| `billing_address` | `text` nullable |
| `credit_limit` | `money` |
| `payment_terms_days` | `integer` |
| `billing_cycle` | `string` |
| `status` | `string` |

### `corporate_contacts`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `name` | `string` |
| `designation` | `string` nullable |
| `email` | `string` nullable |
| `phone` | `string` nullable |
| `is_primary` | `boolean` |

### `corporate_users`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `user_id` | `FK → users` |
| `can_book` | `boolean` |
| `can_view_billing` | `boolean` |
| `status` | `string` |

### `corporate_departments`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `name` | `string` |
| `code` | `string` nullable |

### `corporate_cost_centers`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `department_id` | `FK → corporate_departments` nullable |
| `code` | `string` |
| `name` | `string` |

### `corporate_credit_terms`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |
| `credit_limit` | `money` |
| `payment_terms_days` | `integer` |
| `approval_required` | `boolean` |

### `corporate_billing_profiles`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `billing_name` | `string` |
| `billing_address` | `text` nullable |
| `tax_identifier` | `string` nullable |
| `billing_email` | `string` nullable |
| `is_default` | `boolean` |

### `corporate_service_locations`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `name` | `string` |
| `address` | `text` |
| `latitude` | `decimal` nullable |
| `longitude` | `decimal` nullable |
| `contact_phone` | `string` nullable |

## 05 Contracts

### `corporate_contracts`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `contract_number` | `string` |
| `contract_type` | `string` |
| `start_date` | `date` |
| `end_date` | `date` nullable |
| `monthly_commitment` | `money` nullable |
| `credit_limit` | `money` nullable |
| `billing_cycle` | `string` |
| `payment_terms_days` | `integer` |
| `status` | `string` |
| `terms_conditions` | `text` nullable |

### `corporate_contract_services`

| Column | Definition |
|---|---|
| `contract_id` | `FK → corporate_contracts` |
| `service_type_id` | `FK → rental_service_types` |
| `description` | `string` nullable |
| `included` | `boolean` |

### `corporate_contract_rates`

| Column | Definition |
|---|---|
| `contract_id` | `FK → corporate_contracts` |
| `service_type_id` | `FK → rental_service_types` nullable |
| `route_id` | `FK → routes` nullable |
| `vehicle_category_id` | `FK → vehicle_categories` nullable |
| `unit_type` | `string` |
| `rate` | `money` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |

### `corporate_contract_vehicles`

| Column | Definition |
|---|---|
| `contract_id` | `FK → corporate_contracts` |
| `vehicle_id` | `FK → vehicles` |
| `start_at` | `datetime` |
| `end_at` | `datetime` nullable |
| `dedicated` | `boolean` |

### `corporate_contract_allowances`

| Column | Definition |
|---|---|
| `contract_id` | `FK → corporate_contracts` |
| `allowance_type` | `string` |
| `included_quantity` | `decimal` nullable |
| `excess_unit_rate` | `money` nullable |
| `period` | `string` |

### `corporate_contract_rate_versions`

| Column | Definition |
|---|---|
| `contract_rate_id` | `FK → corporate_contract_rates` |
| `rate` | `money` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |
| `reason` | `text` nullable |

### `corporate_contract_amendments`

| Column | Definition |
|---|---|
| `contract_id` | `FK → corporate_contracts` |
| `amendment_number` | `string` |
| `effective_date` | `date` |
| `changes` | `json` nullable |
| `notes` | `text` nullable |

### `corporate_contract_billing_rules`

| Column | Definition |
|---|---|
| `contract_id` | `FK → corporate_contracts` |
| `rule_type` | `string` |
| `configuration` | `json` nullable |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |

## 06 Pricing

### `rental_service_types`

| Column | Definition |
|---|---|
| `code` | `string` |
| `name` | `string` |
| `billing_unit` | `string` |
| `status` | `string` |

### `rental_packages`

| Column | Definition |
|---|---|
| `service_type_id` | `FK → rental_service_types` |
| `name` | `string` |
| `duration_quantity` | `decimal` nullable |
| `duration_unit` | `string` nullable |
| `status` | `string` |

### `pricing_plans`

| Column | Definition |
|---|---|
| `name` | `string` |
| `customer_segment` | `string` |
| `corporate_contract_id` | `FK → corporate_contracts` nullable |
| `valid_from` | `date` nullable |
| `valid_to` | `date` nullable |
| `priority` | `integer` |
| `status` | `string` |

### `pricing_plan_rates`

| Column | Definition |
|---|---|
| `pricing_plan_id` | `FK → pricing_plans` |
| `service_type_id` | `FK → rental_service_types` |
| `vehicle_id` | `FK → vehicles` nullable |
| `vehicle_category_id` | `FK → vehicle_categories` nullable |
| `package_id` | `FK → rental_packages` nullable |
| `unit_type` | `string` |
| `unit_rate` | `money` |
| `minimum_charge` | `money` nullable |

### `pricing_rule_conditions`

| Column | Definition |
|---|---|
| `pricing_plan_id` | `FK → pricing_plans` |
| `rule_name` | `string` |
| `condition_type` | `string` |
| `condition_data` | `json` |
| `adjustment_type` | `string` |
| `adjustment_value` | `decimal` nullable |
| `priority` | `integer` |

### `service_zones`

| Column | Definition |
|---|---|
| `name` | `string` |
| `code` | `string` nullable |
| `description` | `text` nullable |
| `status` | `string` |

### `routes`

| Column | Definition |
|---|---|
| `origin_zone_id` | `FK → service_zones` nullable |
| `destination_zone_id` | `FK → service_zones` nullable |
| `origin_name` | `string` |
| `destination_name` | `string` |
| `distance_km` | `decimal` nullable |
| `status` | `string` |

### `route_stops`

| Column | Definition |
|---|---|
| `route_id` | `FK → routes` |
| `stop_name` | `string` |
| `sort_order` | `integer` |

### `route_fares`

| Column | Definition |
|---|---|
| `route_id` | `FK → routes` |
| `service_type_id` | `FK → rental_service_types` nullable |
| `vehicle_category_id` | `FK → vehicle_categories` nullable |
| `pricing_plan_id` | `FK → pricing_plans` nullable |
| `fare` | `money` |
| `effective_from` | `date` |
| `effective_to` | `date` nullable |

### `extra_charge_types`

| Column | Definition |
|---|---|
| `code` | `string` |
| `name` | `string` |
| `calculation_method` | `string` |
| `status` | `string` |

### `pricing_extra_charges`

| Column | Definition |
|---|---|
| `pricing_plan_id` | `FK → pricing_plans` nullable |
| `extra_charge_type_id` | `FK → extra_charge_types` |
| `amount` | `money` nullable |
| `rate_percent` | `decimal` nullable |
| `condition_data` | `json` nullable |

### `discounts`

| Column | Definition |
|---|---|
| `code` | `string` |
| `discount_type` | `string` |
| `value` | `decimal` |
| `starts_at` | `datetime` nullable |
| `ends_at` | `datetime` nullable |
| `usage_limit` | `integer` nullable |
| `status` | `string` |

## 07 Booking

### `bookings`

| Column | Definition |
|---|---|
| `booking_number` | `string` |
| `customer_type` | `string` |
| `customer_id` | `FK → customers` nullable |
| `corporate_account_id` | `FK → corporate_accounts` nullable |
| `corporate_contract_id` | `FK → corporate_contracts` nullable |
| `booked_by_user_id` | `FK → users` nullable |
| `service_type_id` | `FK → rental_service_types` |
| `requested_start_at` | `datetime` |
| `requested_end_at` | `datetime` nullable |
| `pickup_address` | `text` nullable |
| `dropoff_address` | `text` nullable |
| `quoted_total` | `money` |
| `payment_policy` | `string` |
| `booking_status` | `string` |
| `notes` | `text` nullable |

### `booking_items`

| Column | Definition |
|---|---|
| `booking_id` | `FK → bookings` |
| `vehicle_id` | `FK → vehicles` nullable |
| `vehicle_category_id` | `FK → vehicle_categories` nullable |
| `service_type_id` | `FK → rental_service_types` |
| `start_at` | `datetime` |
| `end_at` | `datetime` nullable |
| `quantity` | `decimal` |
| `unit_price` | `money` |
| `line_total` | `money` |
| `status` | `string` |

### `booking_price_snapshots`

| Column | Definition |
|---|---|
| `booking_item_id` | `FK → booking_items` |
| `pricing_plan_id` | `FK → pricing_plans` nullable |
| `pricing_details` | `json` |
| `base_amount` | `money` |
| `extras_amount` | `money` |
| `tax_amount` | `money` |
| `discount_amount` | `money` |
| `final_amount` | `money` |

### `booking_status_histories`

| Column | Definition |
|---|---|
| `booking_id` | `FK → bookings` |
| `from_status` | `string` nullable |
| `to_status` | `string` |
| `changed_by` | `FK → users` nullable |
| `reason` | `text` nullable |

### `booking_holds`

| Column | Definition |
|---|---|
| `vehicle_id` | `FK → vehicles` |
| `booking_id` | `FK → bookings` nullable |
| `starts_at` | `datetime` |
| `ends_at` | `datetime` |
| `expires_at` | `datetime` |
| `status` | `string` |

### `booking_cancellations`

| Column | Definition |
|---|---|
| `booking_id` | `FK → bookings` |
| `cancelled_by` | `FK → users` nullable |
| `cancelled_at` | `datetime` |
| `reason` | `text` nullable |
| `cancellation_fee` | `money` |

### `drivers`

| Column | Definition |
|---|---|
| `user_id` | `FK → users` nullable |
| `driver_code` | `string` |
| `name` | `string` |
| `phone` | `string` nullable |
| `license_number` | `string` nullable |
| `license_expiry` | `date` nullable |
| `employment_type` | `string` |
| `status` | `string` |

### `driver_documents`

| Column | Definition |
|---|---|
| `driver_id` | `FK → drivers` |
| `document_type` | `string` |
| `document_number` | `string` nullable |
| `file_path` | `string` nullable |
| `expires_at` | `date` nullable |

### `driver_schedules`

| Column | Definition |
|---|---|
| `driver_id` | `FK → drivers` |
| `start_at` | `datetime` |
| `end_at` | `datetime` |
| `status` | `string` |

### `dispatch_orders`

| Column | Definition |
|---|---|
| `booking_item_id` | `FK → booking_items` |
| `requested_at` | `datetime` |
| `priority` | `string` |
| `status` | `string` |
| `notes` | `text` nullable |

### `dispatch_assignments`

| Column | Definition |
|---|---|
| `dispatch_order_id` | `FK → dispatch_orders` |
| `vehicle_id` | `FK → vehicles` |
| `driver_id` | `FK → drivers` nullable |
| `assigned_at` | `datetime` |
| `released_at` | `datetime` nullable |
| `status` | `string` |

### `trips`

| Column | Definition |
|---|---|
| `booking_item_id` | `FK → booking_items` |
| `dispatch_assignment_id` | `FK → dispatch_assignments` nullable |
| `trip_number` | `string` |
| `actual_start_at` | `datetime` nullable |
| `actual_end_at` | `datetime` nullable |
| `start_odometer` | `decimal` nullable |
| `end_odometer` | `decimal` nullable |
| `trip_status` | `string` |
| `completed_at` | `datetime` nullable |
| `customer_remarks` | `text` nullable |

### `trip_stops`

| Column | Definition |
|---|---|
| `trip_id` | `FK → trips` |
| `stop_type` | `string` |
| `address` | `text` |
| `scheduled_at` | `datetime` nullable |
| `actual_at` | `datetime` nullable |
| `sort_order` | `integer` |

### `trip_events`

| Column | Definition |
|---|---|
| `trip_id` | `FK → trips` |
| `event_type` | `string` |
| `occurred_at` | `datetime` |
| `actor_id` | `FK → users` nullable |
| `payload` | `json` nullable |

### `trip_expenses`

| Column | Definition |
|---|---|
| `trip_id` | `FK → trips` |
| `expense_type` | `string` |
| `amount` | `money` |
| `incurred_at` | `datetime` |
| `notes` | `text` nullable |

### `trip_charge_items`

| Column | Definition |
|---|---|
| `trip_id` | `FK → trips` |
| `charge_type` | `string` |
| `description` | `string` nullable |
| `quantity` | `decimal` |
| `unit_rate` | `money` |
| `amount` | `money` |

### `trip_settlements`

| Column | Definition |
|---|---|
| `trip_id` | `FK → trips` |
| `settled_at` | `datetime` nullable |
| `total_charge` | `money` |
| `collected_amount` | `money` |
| `status` | `string` |

## 08 Billing

### `billing_accounts`

| Column | Definition |
|---|---|
| `customer_id` | `FK → customers` nullable |
| `corporate_account_id` | `FK → corporate_accounts` nullable |
| `currency` | `string` |
| `status` | `string` |

### `billing_cycles`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `period_start` | `date` |
| `period_end` | `date` |
| `status` | `string` |
| `closed_at` | `datetime` nullable |

### `billable_charges`

| Column | Definition |
|---|---|
| `billing_account_id` | `FK → billing_accounts` |
| `booking_id` | `FK → bookings` nullable |
| `trip_id` | `FK → trips` nullable |
| `corporate_contract_id` | `FK → corporate_contracts` nullable |
| `billing_cycle_id` | `FK → billing_cycles` nullable |
| `charge_date` | `date` |
| `charge_type` | `string` |
| `description` | `string` |
| `amount` | `money` |
| `status` | `string` |

### `invoices`

| Column | Definition |
|---|---|
| `billing_account_id` | `FK → billing_accounts` |
| `billing_cycle_id` | `FK → billing_cycles` nullable |
| `invoice_number` | `string` |
| `invoice_date` | `date` |
| `due_date` | `date` nullable |
| `subtotal` | `money` |
| `tax_amount` | `money` |
| `discount_amount` | `money` |
| `total_amount` | `money` |
| `status` | `string` |

### `invoice_items`

| Column | Definition |
|---|---|
| `invoice_id` | `FK → invoices` |
| `description` | `string` |
| `quantity` | `decimal` |
| `unit_price` | `money` |
| `line_total` | `money` |

### `invoice_charge_allocations`

| Column | Definition |
|---|---|
| `invoice_id` | `FK → invoices` |
| `invoice_item_id` | `FK → invoice_items` |
| `billable_charge_id` | `FK → billable_charges` |
| `amount` | `money` |

### `payments`

| Column | Definition |
|---|---|
| `billing_account_id` | `FK → billing_accounts` |
| `payment_number` | `string` |
| `paid_at` | `datetime` nullable |
| `amount` | `money` |
| `payment_method` | `string` |
| `status` | `string` |
| `reference` | `string` nullable |

### `payment_allocations`

| Column | Definition |
|---|---|
| `payment_id` | `FK → payments` |
| `invoice_id` | `FK → invoices` |
| `amount` | `money` |

### `payment_transactions`

| Column | Definition |
|---|---|
| `payment_id` | `FK → payments` |
| `gateway` | `string` nullable |
| `transaction_id` | `string` nullable |
| `request_payload` | `json` nullable |
| `response_payload` | `json` nullable |
| `status` | `string` |

### `credit_notes`

| Column | Definition |
|---|---|
| `invoice_id` | `FK → invoices` |
| `credit_note_number` | `string` |
| `issue_date` | `date` |
| `amount` | `money` |
| `reason` | `text` nullable |
| `status` | `string` |

### `customer_adjustments`

| Column | Definition |
|---|---|
| `billing_account_id` | `FK → billing_accounts` |
| `adjustment_date` | `date` |
| `adjustment_type` | `string` |
| `amount` | `money` |
| `reason` | `text` nullable |

### `corporate_statements`

| Column | Definition |
|---|---|
| `corporate_account_id` | `FK → corporate_accounts` |
| `billing_cycle_id` | `FK → billing_cycles` |
| `period_start` | `date` |
| `period_end` | `date` |
| `opening_balance` | `money` |
| `charges` | `money` |
| `receipts` | `money` |
| `closing_balance` | `money` |

## 09 Finance

### `expense_categories`

| Column | Definition |
|---|---|
| `name` | `string` |
| `code` | `string` nullable |
| `status` | `string` |

### `expenses`

| Column | Definition |
|---|---|
| `expense_category_id` | `FK → expense_categories` |
| `expense_date` | `date` |
| `amount` | `money` |
| `vehicle_id` | `FK → vehicles` nullable |
| `trip_id` | `FK → trips` nullable |
| `description` | `text` nullable |

### `accounts`

| Column | Definition |
|---|---|
| `account_code` | `string` |
| `account_name` | `string` |
| `account_type` | `string` |
| `parent_id` | `bigint` nullable |
| `status` | `string` |

### `financial_periods`

| Column | Definition |
|---|---|
| `period_name` | `string` |
| `start_date` | `date` |
| `end_date` | `date` |
| `status` | `string` |

### `journal_entries`

| Column | Definition |
|---|---|
| `entry_number` | `string` |
| `entry_date` | `date` |
| `financial_period_id` | `FK → financial_periods` nullable |
| `description` | `text` nullable |
| `status` | `string` |

### `journal_entry_lines`

| Column | Definition |
|---|---|
| `journal_entry_id` | `FK → journal_entries` |
| `account_id` | `FK → accounts` |
| `debit` | `money` |
| `credit` | `money` |
| `description` | `string` nullable |

## 10 Cms

### `pages`

| Column | Definition |
|---|---|
| `slug` | `string` |
| `title` | `string` |
| `content` | `longtext` nullable |
| `status` | `string` |

### `sliders`

| Column | Definition |
|---|---|
| `title` | `string` nullable |
| `image_path` | `string` |
| `link` | `string` nullable |
| `sort_order` | `integer` |
| `status` | `string` |

### `faqs`

| Column | Definition |
|---|---|
| `question` | `text` |
| `answer` | `text` |
| `sort_order` | `integer` |
| `status` | `string` |

### `reviews`

| Column | Definition |
|---|---|
| `customer_id` | `FK → customers` nullable |
| `trip_id` | `FK → trips` nullable |
| `rating` | `integer` |
| `comment` | `text` nullable |
| `status` | `string` |

### `notifications`

| Column | Definition |
|---|---|
| `user_id` | `FK → users` nullable |
| `type` | `string` |
| `title` | `string` |
| `body` | `text` |
| `read_at` | `datetime` nullable |
| `payload` | `json` nullable |

### `support_tickets`

| Column | Definition |
|---|---|
| `ticket_number` | `string` |
| `customer_id` | `FK → customers` nullable |
| `corporate_account_id` | `FK → corporate_accounts` nullable |
| `subject` | `string` |
| `description` | `text` nullable |
| `status` | `string` |
| `priority` | `string` |

### `support_ticket_messages`

| Column | Definition |
|---|---|
| `support_ticket_id` | `FK → support_tickets` |
| `user_id` | `FK → users` nullable |
| `message` | `text` |

