-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 16, 2026 at 11:39 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `limozxdb`
--

-- --------------------------------------------------------

--
-- Table structure for table `bookings`
--

CREATE TABLE `bookings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `booking_number` varchar(50) NOT NULL,
  `passenger_id` bigint(20) UNSIGNED DEFAULT NULL,
  `driver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `vehicle_id` bigint(20) UNSIGNED DEFAULT NULL,
  `operator_id` bigint(20) UNSIGNED DEFAULT NULL,
  `pickup_address` varchar(500) NOT NULL,
  `pickup_latitude` decimal(10,8) DEFAULT NULL,
  `pickup_longitude` decimal(11,8) DEFAULT NULL,
  `dropoff_address` varchar(500) NOT NULL,
  `dropoff_latitude` decimal(10,8) DEFAULT NULL,
  `dropoff_longitude` decimal(11,8) DEFAULT NULL,
  `scheduled_at` timestamp NULL DEFAULT NULL,
  `status` enum('pending','confirmed','driver_assigned','in_progress','completed','canceled','no_show') NOT NULL DEFAULT 'pending',
  `trip_type` enum('economy','comfort','premium','shared') NOT NULL DEFAULT 'economy',
  `estimated_distance` decimal(10,2) DEFAULT NULL,
  `estimated_duration_minutes` int(11) DEFAULT NULL,
  `estimated_fare` decimal(10,2) DEFAULT NULL,
  `actual_distance` decimal(10,2) DEFAULT NULL,
  `actual_duration_minutes` int(11) DEFAULT NULL,
  `final_fare` decimal(10,2) DEFAULT NULL,
  `surge_multiplier` decimal(3,2) NOT NULL DEFAULT 1.00,
  `discount_amount` decimal(10,2) DEFAULT NULL,
  `tax_amount` decimal(10,2) DEFAULT NULL,
  `tip_amount` decimal(10,2) DEFAULT NULL,
  `payment_status` enum('pending','paid','failed','refunded') NOT NULL DEFAULT 'pending',
  `payment_method` varchar(50) DEFAULT NULL,
  `special_requests` text DEFAULT NULL,
  `started_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bookings`
--

INSERT INTO `bookings` (`id`, `tenant_id`, `booking_number`, `passenger_id`, `driver_id`, `vehicle_id`, `operator_id`, `pickup_address`, `pickup_latitude`, `pickup_longitude`, `dropoff_address`, `dropoff_latitude`, `dropoff_longitude`, `scheduled_at`, `status`, `trip_type`, `estimated_distance`, `estimated_duration_minutes`, `estimated_fare`, `actual_distance`, `actual_duration_minutes`, `final_fare`, `surge_multiplier`, `discount_amount`, `tax_amount`, `tip_amount`, `payment_status`, `payment_method`, `special_requests`, `started_at`, `completed_at`, `created_at`, `updated_at`) VALUES
(1, 1, 'BK20260215001', NULL, 3, NULL, NULL, 'Durgapur Railway Station, Railway Ground Rail Colony, Durgapur, West Bengal, India', 23.49431730, 87.31772850, 'Netaji Subhash Chandra Bose International Airport (CCU), Airport Service Rd, International Airport, Dum Dum, Kolkata, West Bengal, India', 22.65356400, 88.44508470, '2026-02-15 08:03:00', 'pending', 'economy', 168.10, 180, 2931.50, NULL, NULL, NULL, 1.00, 0.00, 0.00, NULL, 'pending', 'cash', NULL, NULL, NULL, '2026-02-15 13:34:49', '2026-02-15 13:34:49'),
(3, 1, 'BK20260215002', 37, 2, NULL, NULL, 'Delhi cantt railway Junction, Kirby Place, Delhi Cantonment, New Delhi, Delhi, India', 28.61090260, 77.11494720, 'Shimla Railway Station, Cart Road, Nabha, Shimla, Himachal Pradesh, India', 31.10248600, 77.15979600, '2026-02-15 08:18:00', 'pending', 'economy', 353.10, 429, 6204.50, NULL, NULL, NULL, 1.00, 0.00, 0.00, NULL, 'pending', 'cash', NULL, NULL, NULL, '2026-02-15 14:00:14', '2026-02-15 14:00:14'),
(4, 1, 'BK20260215003', 37, 2, NULL, NULL, 'Delhi cantt railway Junction, Kirby Place, Delhi Cantonment, New Delhi, Delhi, India', 28.61090260, 77.11494720, 'Shimla Railway Station, Cart Road, Nabha, Shimla, Himachal Pradesh, India', 31.10248600, 77.15979600, '2026-02-15 08:18:00', 'pending', 'economy', 353.10, 429, 6204.50, NULL, NULL, NULL, 1.00, 0.00, 0.00, NULL, 'pending', 'cash', NULL, NULL, NULL, '2026-02-15 14:03:04', '2026-02-15 14:03:04');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `bookings_booking_number_unique` (`booking_number`),
  ADD KEY `bookings_vehicle_id_foreign` (`vehicle_id`),
  ADD KEY `bookings_operator_id_foreign` (`operator_id`),
  ADD KEY `bookings_tenant_id_index` (`tenant_id`),
  ADD KEY `bookings_booking_number_index` (`booking_number`),
  ADD KEY `bookings_passenger_id_index` (`passenger_id`),
  ADD KEY `bookings_driver_id_index` (`driver_id`),
  ADD KEY `bookings_status_index` (`status`),
  ADD KEY `bookings_created_at_index` (`created_at`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `bookings`
--
ALTER TABLE `bookings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `bookings`
--
ALTER TABLE `bookings`
  ADD CONSTRAINT `bookings_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `bookings_operator_id_foreign` FOREIGN KEY (`operator_id`) REFERENCES `operators` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `bookings_passenger_id_foreign` FOREIGN KEY (`passenger_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `bookings_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bookings_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
