--
-- Host: localhost    Database: elhamd_laravel
-- ------------------------------------------------------


--
-- Table structure for table `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `entity_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `old_values` json DEFAULT NULL,
  `new_values` json DEFAULT NULL,
  `ip_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `activity_logs_entity_type_entity_id_index` (`entity_type`,`entity_id`),
  KEY `activity_logs_user_id_index` (`user_id`),
  CONSTRAINT `activity_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `activity_logs`
--


--
-- Table structure for table `attendance_records`
--

CREATE TABLE `attendance_records` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `employee_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` date NOT NULL,
  `check_in` datetime DEFAULT NULL,
  `check_out` datetime DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PRESENT',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `attendance_records_employee_id_date_unique` (`employee_id`,`date`),
  KEY `attendance_records_date_index` (`date`),
  KEY `attendance_records_status_index` (`status`),
  CONSTRAINT `attendance_records_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `attendance_records`
--


--
-- Table structure for table `audit_logs`
--

CREATE TABLE `audit_logs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned DEFAULT NULL,
  `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `old_values` json DEFAULT NULL,
  `new_values` json DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `audit_logs`
--


--
-- Table structure for table `bill_items`
--

CREATE TABLE `bill_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `bill_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `expense_account_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quantity` int NOT NULL DEFAULT '1',
  `unit_price` decimal(15,2) NOT NULL DEFAULT '0.00',
  `total_price` decimal(15,2) NOT NULL DEFAULT '0.00',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `bill_items_bill_id_foreign` (`bill_id`),
  KEY `bill_items_product_id_foreign` (`product_id`),
  KEY `bill_items_expense_account_id_foreign` (`expense_account_id`),
  CONSTRAINT `bill_items_bill_id_foreign` FOREIGN KEY (`bill_id`) REFERENCES `bills` (`id`) ON DELETE CASCADE,
  CONSTRAINT `bill_items_expense_account_id_foreign` FOREIGN KEY (`expense_account_id`) REFERENCES `chart_of_accounts` (`id`),
  CONSTRAINT `bill_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bill_items`
--


--
-- Table structure for table `bills`
--

CREATE TABLE `bills` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `bill_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `supplier_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `purchase_order_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `issue_date` date NOT NULL,
  `due_date` date NOT NULL,
  `total_amount` decimal(15,2) NOT NULL DEFAULT '0.00',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `bills_bill_number_unique` (`bill_number`),
  KEY `bills_supplier_id_foreign` (`supplier_id`),
  KEY `bills_purchase_order_id_foreign` (`purchase_order_id`),
  KEY `bills_created_by_foreign` (`created_by`),
  CONSTRAINT `bills_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `bills_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`),
  CONSTRAINT `bills_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bills`
--


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

CREATE TABLE `bookings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `service_type_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date` datetime NOT NULL,
  `time_slot` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `total_price` double DEFAULT NULL,
  `payment_status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `payment_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reminder_sent` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `bookings_customer_id_foreign` (`customer_id`),
  KEY `bookings_vehicle_id_foreign` (`vehicle_id`),
  KEY `bookings_service_type_id_foreign` (`service_type_id`),
  CONSTRAINT `bookings_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `bookings_service_type_id_foreign` FOREIGN KEY (`service_type_id`) REFERENCES `service_types` (`id`) ON DELETE SET NULL,
  CONSTRAINT `bookings_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `branch_budgets`
--

CREATE TABLE `branch_budgets` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `allocated_budget` double NOT NULL DEFAULT '0',
  `spent_amount` double NOT NULL DEFAULT '0',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `categories` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `branch_budgets_branch_id_period_unique` (`branch_id`,`period`),
  CONSTRAINT `branch_budgets_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `branch_budgets`
--


--
-- Table structure for table `branch_permissions`
--

CREATE TABLE `branch_permissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `permissions` json NOT NULL,
  `granted_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `granted_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `expires_at` datetime DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `branch_permissions_user_id_branch_id_unique` (`user_id`,`branch_id`),
  KEY `branch_permissions_branch_id_foreign` (`branch_id`),
  CONSTRAINT `branch_permissions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `branch_permissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `branch_permissions`
--


--
-- Table structure for table `branch_transfers`
--

CREATE TABLE `branch_transfers` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `from_branch_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `to_branch_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entity_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `reason` text COLLATE utf8mb4_unicode_ci,
  `requested_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `branch_transfers_from_branch_id_foreign` (`from_branch_id`),
  KEY `branch_transfers_to_branch_id_foreign` (`to_branch_id`),
  KEY `branch_transfers_requested_by_foreign` (`requested_by`),
  CONSTRAINT `branch_transfers_from_branch_id_foreign` FOREIGN KEY (`from_branch_id`) REFERENCES `branches` (`id`),
  CONSTRAINT `branch_transfers_requested_by_foreign` FOREIGN KEY (`requested_by`) REFERENCES `users` (`id`),
  CONSTRAINT `branch_transfers_to_branch_id_foreign` FOREIGN KEY (`to_branch_id`) REFERENCES `branches` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `branch_transfers`
--


--
-- Table structure for table `branches`
--

CREATE TABLE `branches` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `manager_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `opening_date` datetime DEFAULT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `timezone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Africa/Cairo',
  `map_lat` double DEFAULT NULL,
  `map_lng` double DEFAULT NULL,
  `google_map_link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `settings` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `branches_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `branches`
--

INSERT INTO `branches` VALUES ('019c67d1-c3d3-705d-adf1-e171f8638204','الفرع الرئيسي - بورسعيد','ELHAMD-PORTSAID','بورسعيد، مصر','+20 2 12345678','info@elhamdimport.online',NULL,1,NULL,'EGP','Africa/Cairo',NULL,NULL,NULL,NULL,'2026-02-16 16:58:46','2026-02-16 16:58:46'),('019c67d1-c3d7-70f6-9cd2-41cf9b707af4','فرع القنطرة غرب','ELHAMD-QANTARA','القنطرة غرب، الإسماعيلية، مصر','+20 2 12345679','qantara@elhamdimport.online',NULL,1,NULL,'EGP','Africa/Cairo',NULL,NULL,NULL,NULL,'2026-02-16 16:58:46','2026-02-16 16:58:46'),('019c67e7-cd93-7313-83d5-563ebca52f79','الفرع الرئيسي - القنطرة غرب','ELHAMD-MAIN','القنطرة غرب، الجيزة، مصر','+20 2 12345678','info@elhamdimport.online',NULL,1,'2010-01-01 00:00:00','EGP','Africa/Cairo',NULL,NULL,NULL,'{\"services\": [\"صيانة\", \"قطع غيار\", \"تأجير\", \"بيع سيارات\"]}','2026-02-16 17:22:50','2026-02-16 17:22:50'),('28fb3845-7030-4228-ac2f-68378a0ebd38','المقر الرئيسي','HQ','القاهرة، مصر','+201000000001','hq@elhamd.com',NULL,1,NULL,'EGP','Africa/Cairo',NULL,NULL,NULL,NULL,'2026-02-16 13:47:58','2026-02-16 13:47:58'),('6206b4a5-908e-4060-83de-2d1c8bf00d8c','فرع الإسكندرية','ALEX','الإسكندرية، مصر','+201000000002','alex@elhamd.com',NULL,1,NULL,'EGP','Africa/Cairo',NULL,NULL,NULL,NULL,'2026-02-16 13:47:58','2026-02-16 13:47:58');

--
-- Table structure for table `calendar_events`
--

CREATE TABLE `calendar_events` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'APPOINTMENT',
  `start_time` datetime NOT NULL,
  `end_time` datetime NOT NULL,
  `all_day` tinyint(1) NOT NULL DEFAULT '0',
  `location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'SCHEDULED',
  `color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `assigned_to` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `calendar_events_created_by_foreign` (`created_by`),
  KEY `calendar_events_assigned_to_foreign` (`assigned_to`),
  KEY `calendar_events_branch_id_foreign` (`branch_id`),
  KEY `calendar_events_start_time_index` (`start_time`),
  CONSTRAINT `calendar_events_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `calendar_events_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `calendar_events_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `calendar_events`
--


--
-- Table structure for table `campaign_members`
--

CREATE TABLE `campaign_members` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `campaign_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lead_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `campaign_members_campaign_id_foreign` (`campaign_id`),
  KEY `campaign_members_customer_id_foreign` (`customer_id`),
  KEY `campaign_members_lead_id_foreign` (`lead_id`),
  CONSTRAINT `campaign_members_campaign_id_foreign` FOREIGN KEY (`campaign_id`) REFERENCES `marketing_campaigns` (`id`) ON DELETE CASCADE,
  CONSTRAINT `campaign_members_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE SET NULL,
  CONSTRAINT `campaign_members_lead_id_foreign` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `campaign_members`
--


--
-- Table structure for table `campaigns`
--

CREATE TABLE `campaigns` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `target_audience` json DEFAULT NULL,
  `budget` double DEFAULT NULL,
  `start_date` datetime DEFAULT NULL,
  `end_date` datetime DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `campaigns_created_by_foreign` (`created_by`),
  CONSTRAINT `campaigns_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `campaigns`
--


--
-- Table structure for table `chart_of_accounts`
--

CREATE TABLE `chart_of_accounts` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `parent_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `normal_balance` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `chart_of_accounts_code_unique` (`code`),
  KEY `chart_of_accounts_code_index` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `chart_of_accounts`
--


--
-- Table structure for table `commerce_settings`
--

CREATE TABLE `commerce_settings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `settings` json NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `commerce_settings`
--


--
-- Table structure for table `company_features`
--

CREATE TABLE `company_features` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `company_features`
--

INSERT INTO `company_features` VALUES ('019c67fe-9ba0-7072-8fd3-b85e976f1e2e','الجودة','ميزة تنافسية لشركتنا',NULL,NULL,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9ba3-70d8-a885-eb4f2f3aa496','الموثوقية','ميزة تنافسية لشركتنا',NULL,NULL,2,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9ba6-72b6-9b67-45bba35d838e','خدمة العملاء','ميزة تنافسية لشركتنا',NULL,NULL,3,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9baa-70d6-be4b-93786fea2097','الابتكار','ميزة تنافسية لشركتنا',NULL,NULL,4,'2026-02-16 17:47:45','2026-02-16 17:47:45');

--
-- Table structure for table `company_info`
--

CREATE TABLE `company_info` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `mission` text COLLATE utf8mb4_unicode_ci,
  `vision` text COLLATE utf8mb4_unicode_ci,
  `logo_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `settings` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `company_info`
--

INSERT INTO `company_info` VALUES ('main','شركة الحمد لاستيراد السيارات','الموزع المعتمد لسيارات تاتا في مدن القناة، متخصصون في السيارات التجارية والبيك أب والشاحنات فقط','نقدم منتجات وخدمات عالية الجودة تلبي أعلى المعايير','نسعى دائماً للابتكار وتطوير حلول جديدة',NULL,'{\"cta\": [{\"link\": \"/vehicles\", \"text\": \"استعرض السيارات\"}, {\"link\": \"/test-drive\", \"text\": \"قيادة تجريبية\"}]}','2026-02-17 09:48:41','2026-02-17 09:48:41');

--
-- Table structure for table `company_infos`
--

CREATE TABLE `company_infos` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'مرحباً بك في الحمد للسيارات',
  `subtitle` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `features` json DEFAULT NULL,
  `cta_buttons` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `company_infos`
--

INSERT INTO `company_infos` VALUES (1,'مرحباً بك في الحمد للسيارات','الموزع المعتمد لسيارات تاتا في مدن القناة','نحن نفخر بكوننا الوجهة الأولى لسيارات تاتا في بورسعيد والإسماعيلية. نقدم أحدث الموديلات مع خدمات متكاملة تشمل البيع، الصيانة، وقطع الغيار الأصلية.','images/showroom-luxury.jpg','[\"أحدث موديلات تاتا 2024\", \"ضمان المصنع لمدة 3 سنوات\", \"ضمان صيانة على مدار الساعة\", \"تمويل سيارات بأفضل الأسعار\"]','[{\"link\": \"http://localhost/vehicles\", \"text\": \"استعرض السيارات\", \"variant\": \"primary\"}, {\"link\": \"http://localhost/contact\", \"text\": \"قيادة تجريبية\", \"variant\": \"secondary\"}]','2026-02-17 10:01:24','2026-02-17 10:01:24');

--
-- Table structure for table `company_stats`
--

CREATE TABLE `company_stats` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `company_stats`
--

INSERT INTO `company_stats` VALUES ('019c67fe-9b6a-7303-8b15-24f1db382dcc','عملاء سعداء','5000+','fas fa-users',1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b6d-73f8-afa5-323b558528ce','مركبة مباعة','10000+','fas fa-truck',2,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b6f-7340-b587-d9617f9c2eb8','سنوات خبرة','14+','fas fa-award',3,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b72-7245-8a79-b34e357b9674','فروع','2','fas fa-map-marker-alt',4,'2026-02-16 17:47:45','2026-02-16 17:47:45');

--
-- Table structure for table `company_values`
--

CREATE TABLE `company_values` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `company_values`
--

INSERT INTO `company_values` VALUES ('019c67fe-9b77-70a6-861e-5e9d7a469ece','الجودة','نقدم منتجات وخدمات عالية الجودة تلبي أعلى المعايير','fas fa-shield-alt',1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b7a-71b0-b60a-32c472065ca4','الموثوقية','نضمن موثوقية عالية في جميع منتجاتنا وخدماتنا','fas fa-check-circle',2,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b7c-7354-8ac9-61bbf3048441','خدمة العملاء','نقدم خدمة عملاء ممتازة على مدار الساعة','fas fa-headset',3,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b7f-7112-9a19-0d074f0dec2e','الابتكار','نسعى دائماً للابتكار وتطوير حلول جديدة','fas fa-lightbulb',4,'2026-02-16 17:47:45','2026-02-16 17:47:45');

--
-- Table structure for table `complaint_follow_ups`
--

CREATE TABLE `complaint_follow_ups` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `complaint_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `author_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `next_follow_up` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `complaint_follow_ups_complaint_id_foreign` (`complaint_id`),
  KEY `complaint_follow_ups_author_id_foreign` (`author_id`),
  CONSTRAINT `complaint_follow_ups_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
  CONSTRAINT `complaint_follow_ups_complaint_id_foreign` FOREIGN KEY (`complaint_id`) REFERENCES `complaints` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `complaint_follow_ups`
--


--
-- Table structure for table `complaints`
--

CREATE TABLE `complaints` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `complaint_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'SERVICE',
  `severity` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MEDIUM',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'RECEIVED',
  `assigned_to` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `resolution` text COLLATE utf8mb4_unicode_ci,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `complaints_complaint_number_unique` (`complaint_number`),
  KEY `complaints_assigned_to_foreign` (`assigned_to`),
  KEY `complaints_branch_id_foreign` (`branch_id`),
  KEY `complaints_number_idx` (`complaint_number`),
  KEY `complaints_subject_idx` (`subject`),
  KEY `complaints_status_idx` (`status`),
  KEY `complaints_customer_idx` (`customer_id`),
  CONSTRAINT `complaints_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `complaints_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `complaints_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `complaints`
--


--
-- Table structure for table `consultation_submissions`
--

CREATE TABLE `consultation_submissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `consultation_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `preferred_date` datetime NOT NULL,
  `preferred_time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `submitted_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `consultation_submissions`
--


--
-- Table structure for table `contact_info`
--

CREATE TABLE `contact_info` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `map_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `working_hours` json DEFAULT NULL,
  `social_links` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `contact_info`
--

INSERT INTO `contact_info` VALUES ('019c67fe-9b59-7125-b669-c96df4bbf2b5','+20 2 12345678','info@elhamdimport.online','القنطرة غرب، الجيزة، مصر','https://maps.google.com/?q=30.0131,31.2089','{\"Friday\": \"مغلق\", \"Monday\": \"9:00-17:00\", \"Sunday\": \"9:00-17:00\", \"Tuesday\": \"9:00-17:00\", \"Saturday\": \"9:00-17:00\", \"Thursday\": \"9:00-17:00\", \"Wednesday\": \"9:00-17:00\"}',NULL,'2026-02-16 17:47:45','2026-02-16 17:47:45');

--
-- Table structure for table `contact_messages`
--

CREATE TABLE `contact_messages` (
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NEW',
  `read_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 `contact_messages`
--


--
-- Table structure for table `contracts`
--

CREATE TABLE `contracts` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `contract_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `value` double NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `terms` json DEFAULT NULL,
  `attachments` json DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `contracts_contract_number_unique` (`contract_number`),
  KEY `contracts_customer_id_foreign` (`customer_id`),
  KEY `contracts_vehicle_id_foreign` (`vehicle_id`),
  KEY `contracts_created_by_foreign` (`created_by`),
  KEY `contracts_branch_id_foreign` (`branch_id`),
  KEY `contracts_type_status_index` (`type`,`status`),
  CONSTRAINT `contracts_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `contracts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `contracts_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `contracts_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `contracts`
--


--
-- Table structure for table `crm_interactions`
--

CREATE TABLE `crm_interactions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lead_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `opportunity_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `performed_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `interaction_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `outcome` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `crm_interactions_lead_id_foreign` (`lead_id`),
  KEY `crm_interactions_opportunity_id_foreign` (`opportunity_id`),
  KEY `crm_interactions_performed_by_foreign` (`performed_by`),
  CONSTRAINT `crm_interactions_lead_id_foreign` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE SET NULL,
  CONSTRAINT `crm_interactions_opportunity_id_foreign` FOREIGN KEY (`opportunity_id`) REFERENCES `opportunities` (`id`) ON DELETE SET NULL,
  CONSTRAINT `crm_interactions_performed_by_foreign` FOREIGN KEY (`performed_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `crm_interactions`
--


--
-- Table structure for table `customer_feedbacks`
--

CREATE TABLE `customer_feedbacks` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'GENERAL',
  `rating` int NOT NULL DEFAULT '0',
  `comment` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `response` text COLLATE utf8mb4_unicode_ci,
  `responded_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `responded_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `customer_feedbacks_customer_id_index` (`customer_id`),
  CONSTRAINT `customer_feedbacks_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_feedbacks`
--


--
-- Table structure for table `customer_interactions`
--

CREATE TABLE `customer_interactions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `performed_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `interaction_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `outcome` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `customer_interactions_performed_by_foreign` (`performed_by`),
  KEY `customer_interactions_customer_id_interaction_date_index` (`customer_id`,`interaction_date`),
  CONSTRAINT `customer_interactions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `customer_interactions_performed_by_foreign` FOREIGN KEY (`performed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_interactions`
--


--
-- Table structure for table `customer_journeys`
--

CREATE TABLE `customer_journeys` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `event` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `channel` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'WEB',
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `customer_journeys_customer_id_index` (`customer_id`),
  CONSTRAINT `customer_journeys_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_journeys`
--


--
-- Table structure for table `customer_lifecycles`
--

CREATE TABLE `customer_lifecycles` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stage` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'AWARENESS',
  `sub_stage` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `entry_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `exit_date` datetime DEFAULT NULL,
  `duration` int DEFAULT NULL,
  `score` int NOT NULL DEFAULT '0',
  `next_stage` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `actions` json DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `customer_lifecycles_customer_id_stage_unique` (`customer_id`,`stage`),
  CONSTRAINT `customer_lifecycles_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_lifecycles`
--


--
-- Table structure for table `customer_profiles`
--

CREATE TABLE `customer_profiles` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `segment` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'LEAD',
  `lead_source` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lead_value` double NOT NULL DEFAULT '0',
  `lifetime_value` double NOT NULL DEFAULT '0',
  `last_contact_date` datetime DEFAULT NULL,
  `next_follow_up` datetime DEFAULT NULL,
  `preferences` json DEFAULT NULL,
  `tags` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `customer_profiles_user_id_unique` (`user_id`),
  CONSTRAINT `customer_profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_profiles`
--


--
-- Table structure for table `customer_service_metrics`
--

CREATE TABLE `customer_service_metrics` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` datetime NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DAILY',
  `tickets_received` int NOT NULL DEFAULT '0',
  `tickets_resolved` int NOT NULL DEFAULT '0',
  `tickets_open` int NOT NULL DEFAULT '0',
  `avg_resolution_time` double NOT NULL DEFAULT '0',
  `avg_response_time` double NOT NULL DEFAULT '0',
  `customer_satisfaction` double NOT NULL DEFAULT '0',
  `escalations` int NOT NULL DEFAULT '0',
  `complaints` int NOT NULL DEFAULT '0',
  `complaints_resolved` int NOT NULL DEFAULT '0',
  `evaluations` int NOT NULL DEFAULT '0',
  `avg_rating` double NOT NULL DEFAULT '0',
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `customer_service_metrics_date_period_branch_id_unique` (`date`,`period`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_service_metrics`
--


--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `departments_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` VALUES ('019c67cc-c16a-716f-9b19-41c9cf4c5778','الإدارة العامة',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c176-72a1-9a33-8eefc89c7233','المبيعات',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c17a-7248-b8be-848c9dff810d','التسويق',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c17d-72b9-bdb2-a489c8795526','المحاسبة',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c180-7254-bbb9-b6efbf805216','الموارد البشرية',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c183-711a-b1e4-8942f97c68b4','خدمة العملاء',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c186-725f-a00b-1c6a9d1a55fe','الصيانة',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c18b-713a-99e2-5d3f40ee6f3a','تكنولوجيا المعلومات',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18');

--
-- Table structure for table `email_templates`
--

CREATE TABLE `email_templates` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `body` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `variables` json DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email_templates_name_type_unique` (`name`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `email_templates`
--


--
-- Table structure for table `employee_profiles`
--

CREATE TABLE `employee_profiles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `department` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `position` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `salary` decimal(10,2) NOT NULL,
  `hire_date` date NOT NULL,
  `emergency_contact_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `emergency_contact_phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `emergency_contact_relationship` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `employee_profiles_user_id_foreign` (`user_id`),
  CONSTRAINT `employee_profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `employee_profiles`
--


--
-- Table structure for table `employees`
--

CREATE TABLE `employees` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `employee_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `department_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `position_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hire_date` datetime NOT NULL,
  `salary` double NOT NULL,
  `bank_account` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tax_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `insurance_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `manager_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `emergency_contact` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `payroll_expense_account_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payroll_liability_account_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `employees_employee_number_unique` (`employee_number`),
  UNIQUE KEY `employees_user_id_unique` (`user_id`),
  KEY `employees_position_id_foreign` (`position_id`),
  KEY `employees_manager_id_foreign` (`manager_id`),
  KEY `employees_branch_id_foreign` (`branch_id`),
  KEY `employees_employee_number_index` (`employee_number`),
  KEY `employees_department_id_index` (`department_id`),
  KEY `employees_status_index` (`status`),
  CONSTRAINT `employees_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `employees_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `employees_manager_id_foreign` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  CONSTRAINT `employees_position_id_foreign` FOREIGN KEY (`position_id`) REFERENCES `positions` (`id`) ON DELETE SET NULL,
  CONSTRAINT `employees_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `employees`
--


--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--


--
-- Table structure for table `faqs`
--

CREATE TABLE `faqs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `question` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `answer` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'General',
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `faqs`
--

INSERT INTO `faqs` VALUES (1,'هل السيارات جديدة أم مستعملة؟','نحن نستورد سيارات جديدة بالكامل من المصنعين المعتمدين، مع ضمان المصنع الأصلي.','Vehicles',1,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(2,'ما هي الدول التي نستورد منها؟','نستورد السيارات من اليابان، كوريا، ألمانيا، والولايات المتحدة الأمريكية من وكلاء معتمدين.','Vehicles',2,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(3,'هل يمكن طلب سيارة معينة؟','نعم، يمكنكم طلب أي سيارة مع المواصفات المطلوبة وسنقوم باستيرادها خصيصاً لكم.','Vehicles',3,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(4,'كم تستغرق عملية الاستيراد؟','تستغرق عملية الاستيراد من 4 إلى 8 أسابيع حسب بلد المنشأ والإجراءات الجمركية.','Vehicles',4,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(5,'ما هو الضمان المقدم على السيارات؟','نقدم ضماناً شاملاً لمدة سنة أو 20,000 كم، مع إمكانية التمديد لفترات أطول.','Maintenance',5,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(6,'أين يمكنني صيانة السيارة؟','لدينا مراكز صيانة معتمدة في جميع المحافظات، بالإضافة إلى الوكلاء المعتمدين من الشركة المصنعة.','Maintenance',6,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(7,'هل قطع الغيار أصلية؟','نعم، نستخدم فقط قطع الغيار الأصلية من الشركة المصنعة لضمان الجودة والأداء.','Maintenance',7,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(8,'ماذا يغطي الضمان؟','يغطي الضمان جميع الأعطال الميكانيكية والكهربائية، مع استثناء التآكل الطبيعي والأضرار الناتجة عن الحوادث.','Maintenance',8,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(9,'هل تقدمون تمويلاً للسيارات؟','نعم، نتعاون مع أكبر البنوك وشركات التمويل لتقديم أفضل شروط التمويل.','Finance',9,1,'2026-02-17 09:48:41','2026-02-17 09:48:41'),(10,'ما هي المبالغ المقدمة المطلوبة؟','تتراوح المبالغ المقدمة من 20% إلى 30% حسب نوع السيارة وشروط التمويل.','Finance',10,1,'2026-02-17 09:48:42','2026-02-17 09:48:42'),(11,'ما هي طرق الدفع المتاحة؟','نقبل الدفع النقدي، الشيكات، البطاقات الائتمانية، والتحويل البنكي.','Finance',11,1,'2026-02-17 09:48:42','2026-02-17 09:48:42'),(12,'هل يمكن التقسيط بدون مقدم؟','بعض السيارات المتوسطة تتوفر فيها خطط تقسيط بدون مقدم للعملاء ذوي السجل الائتماني الجيد.','Finance',12,1,'2026-02-17 09:48:42','2026-02-17 09:48:42'),(13,'ما هي المستندات المطلوبة للشراء؟','بطاقة الرقم القومي سارية، إثبات العنوان، وإيصال مرتب حديث للموظفين.','Procedures',13,1,'2026-02-17 09:48:42','2026-02-17 09:48:42'),(14,'هل تتعاملون مع الشركات؟','نعم، لدينا قسم خاص للتعامل مع الشركات وتوفير أساطيل السيارات.','Procedures',14,1,'2026-02-17 09:48:42','2026-02-17 09:48:42'),(15,'هل السيارات مؤمنة؟','نوفر تأميناً شاملاً على جميع السيارات مع أفضل شركات التأمين في مصر.','Procedures',15,1,'2026-02-17 09:48:42','2026-02-17 09:48:42'),(16,'ما هي رسوم التسجيل؟','رسوم التسجيل والجمارك مضمنة في السعر النهائي للسيارة.','Procedures',16,1,'2026-02-17 09:48:42','2026-02-17 09:48:42');

--
-- Table structure for table `financial_reports`
--

CREATE TABLE `financial_reports` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `parameters` json DEFAULT NULL,
  `generated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `generated_by` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `data` json DEFAULT NULL,
  `file_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'GENERATING',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `financial_reports`
--


--
-- Table structure for table `footer_columns`
--

CREATE TABLE `footer_columns` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'LINKS',
  `items` json DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `footer_columns`
--


--
-- Table structure for table `footer_contents`
--

CREATE TABLE `footer_contents` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `copyright` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `settings` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `footer_contents`
--


--
-- Table structure for table `footer_socials`
--

CREATE TABLE `footer_socials` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `platform` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `footer_socials`
--


--
-- Table structure for table `goods_receipt_items`
--

CREATE TABLE `goods_receipt_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `goods_receipt_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `purchase_order_item_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quantity_received` int NOT NULL,
  `batch_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `goods_receipt_items_goods_receipt_id_foreign` (`goods_receipt_id`),
  KEY `goods_receipt_items_purchase_order_item_id_foreign` (`purchase_order_item_id`),
  KEY `goods_receipt_items_product_id_foreign` (`product_id`),
  CONSTRAINT `goods_receipt_items_goods_receipt_id_foreign` FOREIGN KEY (`goods_receipt_id`) REFERENCES `goods_receipts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `goods_receipt_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `goods_receipt_items_purchase_order_item_id_foreign` FOREIGN KEY (`purchase_order_item_id`) REFERENCES `purchase_order_items` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `goods_receipt_items`
--


--
-- Table structure for table `goods_receipts`
--

CREATE TABLE `goods_receipts` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `receipt_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `purchase_order_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `received_date` date NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `received_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `goods_receipts_receipt_number_unique` (`receipt_number`),
  KEY `goods_receipts_purchase_order_id_foreign` (`purchase_order_id`),
  KEY `goods_receipts_received_by_foreign` (`received_by`),
  CONSTRAINT `goods_receipts_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`),
  CONSTRAINT `goods_receipts_received_by_foreign` FOREIGN KEY (`received_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `goods_receipts`
--


--
-- Table structure for table `header_contents`
--

CREATE TABLE `header_contents` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `logo_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `logo_alt` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `announcement` text COLLATE utf8mb4_unicode_ci,
  `show_announcement` tinyint(1) NOT NULL DEFAULT '0',
  `settings` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `header_contents`
--


--
-- Table structure for table `header_navigations`
--

CREATE TABLE `header_navigations` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `parent_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `header_navigations`
--


--
-- Table structure for table `holidays`
--

CREATE TABLE `holidays` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` date NOT NULL,
  `is_recurring` tinyint(1) NOT NULL DEFAULT '0',
  `description` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `holidays_name_date_unique` (`name`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `holidays`
--


--
-- Table structure for table `homepage_settings`
--

CREATE TABLE `homepage_settings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `section` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` json DEFAULT NULL,
  `is_visible` tinyint(1) NOT NULL DEFAULT '1',
  `order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `homepage_settings_section_unique` (`section`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `homepage_settings`
--


--
-- Table structure for table `insurance_claims`
--

CREATE TABLE `insurance_claims` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `claim_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `policy_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `incident_date` datetime NOT NULL,
  `incident_location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `estimated_amount` double DEFAULT NULL,
  `approved_amount` double DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `documents` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `assigned_to` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `resolved_at` datetime DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `insurance_claims_claim_number_unique` (`claim_number`),
  KEY `insurance_claims_policy_id_foreign` (`policy_id`),
  KEY `insurance_claims_vehicle_id_foreign` (`vehicle_id`),
  KEY `insurance_claims_customer_id_foreign` (`customer_id`),
  KEY `insurance_claims_created_by_foreign` (`created_by`),
  KEY `insurance_claims_status_index` (`status`),
  CONSTRAINT `insurance_claims_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `insurance_claims_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `insurance_claims_policy_id_foreign` FOREIGN KEY (`policy_id`) REFERENCES `insurance_policies` (`id`),
  CONSTRAINT `insurance_claims_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `insurance_claims`
--


--
-- Table structure for table `insurance_companies`
--

CREATE TABLE `insurance_companies` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `contact_person` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `website` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `insurance_companies_name_unique` (`name`),
  UNIQUE KEY `insurance_companies_code_unique` (`code`),
  KEY `insurance_companies_created_by_foreign` (`created_by`),
  CONSTRAINT `insurance_companies_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `insurance_companies`
--


--
-- Table structure for table `insurance_payments`
--

CREATE TABLE `insurance_payments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `policy_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `claim_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `payment_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `payment_date` datetime DEFAULT NULL,
  `due_date` datetime DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `insurance_payments_policy_id_foreign` (`policy_id`),
  KEY `insurance_payments_claim_id_foreign` (`claim_id`),
  KEY `insurance_payments_created_by_foreign` (`created_by`),
  CONSTRAINT `insurance_payments_claim_id_foreign` FOREIGN KEY (`claim_id`) REFERENCES `insurance_claims` (`id`) ON DELETE SET NULL,
  CONSTRAINT `insurance_payments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `insurance_payments_policy_id_foreign` FOREIGN KEY (`policy_id`) REFERENCES `insurance_policies` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `insurance_payments`
--


--
-- Table structure for table `insurance_policies`
--

CREATE TABLE `insurance_policies` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `policy_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `premium` double NOT NULL,
  `coverage` json DEFAULT NULL,
  `deductible` double NOT NULL DEFAULT '0',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `documents` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `insurance_policies_policy_number_unique` (`policy_number`),
  KEY `insurance_policies_vehicle_id_foreign` (`vehicle_id`),
  KEY `insurance_policies_customer_id_foreign` (`customer_id`),
  KEY `insurance_policies_company_id_foreign` (`company_id`),
  KEY `insurance_policies_created_by_foreign` (`created_by`),
  KEY `insurance_policies_status_index` (`status`),
  CONSTRAINT `insurance_policies_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `insurance_companies` (`id`),
  CONSTRAINT `insurance_policies_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `insurance_policies_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `insurance_policies_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `insurance_policies`
--


--
-- Table structure for table `invoice_installments`
--

CREATE TABLE `invoice_installments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sequence` int NOT NULL,
  `amount` double NOT NULL,
  `due_date` datetime NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `paid_amount` double NOT NULL DEFAULT '0',
  `paid_at` datetime DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `payment_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invoice_installments_invoice_id_sequence_unique` (`invoice_id`,`sequence`),
  KEY `invoice_installments_payment_id_foreign` (`payment_id`),
  CONSTRAINT `invoice_installments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `invoice_installments_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_installments`
--


--
-- Table structure for table `invoice_items`
--

CREATE TABLE `invoice_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `inventory_item_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` int NOT NULL DEFAULT '1',
  `unit_price` double NOT NULL DEFAULT '0',
  `total_price` double NOT NULL DEFAULT '0',
  `tax_rate` double NOT NULL DEFAULT '0',
  `tax_amount` double NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_items_invoice_id_foreign` (`invoice_id`),
  KEY `invoice_items_vehicle_id_foreign` (`vehicle_id`),
  CONSTRAINT `invoice_items_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `invoice_items_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_items`
--


--
-- Table structure for table `invoice_payments`
--

CREATE TABLE `invoice_payments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payment_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `payment_date` datetime NOT NULL,
  `payment_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `transaction_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invoice_payments_invoice_id_payment_id_unique` (`invoice_id`,`payment_id`),
  KEY `invoice_payments_payment_id_foreign` (`payment_id`),
  CONSTRAINT `invoice_payments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `invoice_payments_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_payments`
--


--
-- Table structure for table `invoice_taxes`
--

CREATE TABLE `invoice_taxes` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tax_rate_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tax_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate` double NOT NULL DEFAULT '0',
  `tax_amount` double NOT NULL DEFAULT '0',
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_taxes_invoice_id_foreign` (`invoice_id`),
  KEY `invoice_taxes_tax_rate_id_foreign` (`tax_rate_id`),
  CONSTRAINT `invoice_taxes_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `invoice_taxes_tax_rate_id_foreign` FOREIGN KEY (`tax_rate_id`) REFERENCES `tax_rates` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_taxes`
--


--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'SERVICE',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `payment_status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `issue_date` datetime NOT NULL,
  `due_date` datetime NOT NULL,
  `subtotal` double NOT NULL DEFAULT '0',
  `tax_amount` double NOT NULL DEFAULT '0',
  `total_amount` double NOT NULL DEFAULT '0',
  `paid_amount` double NOT NULL DEFAULT '0',
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `terms` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invoices_invoice_number_unique` (`invoice_number`),
  KEY `invoices_branch_id_foreign` (`branch_id`),
  KEY `invoices_vehicle_id_foreign` (`vehicle_id`),
  KEY `invoices_number_idx` (`invoice_number`),
  KEY `invoices_status_idx` (`status`),
  KEY `invoices_payment_status_idx` (`payment_status`),
  KEY `invoices_customer_idx` (`customer_id`),
  CONSTRAINT `invoices_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `invoices_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `invoices_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoices`
--

INSERT INTO `invoices` VALUES ('019c5d5f-0576-738e-a1a8-901181b93479','INV-VERIFY-1771093034','019c5d5f-0562-7188-a8d0-5d9f2b26de1e',NULL,'019c5d5f-056c-720e-9ce9-ec49aa2715e9','SERVICE','PAID','PAID','2026-02-14 18:17:14','2026-02-21 18:17:14',500,70,570,570,'EGP',NULL,NULL,NULL,0,'2026-02-14 16:17:14','2026-02-14 16:17:14',NULL);

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_jobs` int NOT NULL,
  `pending_jobs` int NOT NULL,
  `failed_jobs` int NOT NULL,
  `failed_job_ids` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `options` mediumtext COLLATE utf8mb4_unicode_ci,
  `cancelled_at` int DEFAULT NULL,
  `created_at` int NOT NULL,
  `finished_at` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `job_batches`
--


--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` tinyint unsigned NOT NULL,
  `reserved_at` int unsigned DEFAULT NULL,
  `available_at` int unsigned NOT NULL,
  `created_at` int unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `jobs`
--


--
-- Table structure for table `journal_entries`
--

CREATE TABLE `journal_entries` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entry_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` datetime NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `total_debit` double NOT NULL,
  `total_credit` double NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `journal_entries_entry_number_unique` (`entry_number`),
  KEY `journal_entries_date_index` (`date`),
  KEY `journal_entries_created_by_foreign` (`created_by`),
  KEY `journal_entries_branch_id_foreign` (`branch_id`),
  CONSTRAINT `journal_entries_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `journal_entries_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `journal_entries`
--


--
-- Table structure for table `journal_entry_items`
--

CREATE TABLE `journal_entry_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `entry_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `account_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `debit` double NOT NULL DEFAULT '0',
  `credit` double NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `journal_entry_items_entry_id_index` (`entry_id`),
  KEY `journal_entry_items_account_id_index` (`account_id`),
  CONSTRAINT `journal_entry_items_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `chart_of_accounts` (`id`),
  CONSTRAINT `journal_entry_items_entry_id_foreign` FOREIGN KEY (`entry_id`) REFERENCES `journal_entries` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `journal_entry_items`
--


--
-- Table structure for table `knowledge_base_articles`
--

CREATE TABLE `knowledge_base_articles` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `excerpt` text COLLATE utf8mb4_unicode_ci,
  `category_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `author_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `view_count` int NOT NULL DEFAULT '0',
  `helpful_count` int NOT NULL DEFAULT '0',
  `is_featured` tinyint(1) NOT NULL DEFAULT '0',
  `is_public` tinyint(1) NOT NULL DEFAULT '1',
  `published_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `knowledge_base_articles_slug_unique` (`slug`),
  KEY `knowledge_base_articles_category_id_foreign` (`category_id`),
  KEY `knowledge_base_articles_author_id_foreign` (`author_id`),
  CONSTRAINT `knowledge_base_articles_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
  CONSTRAINT `knowledge_base_articles_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `knowledge_base_categories` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `knowledge_base_articles`
--


--
-- Table structure for table `knowledge_base_categories`
--

CREATE TABLE `knowledge_base_categories` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sort_order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `parent_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `knowledge_base_categories_name_unique` (`name`),
  UNIQUE KEY `knowledge_base_categories_slug_unique` (`slug`),
  KEY `knowledge_base_categories_parent_id_foreign` (`parent_id`),
  CONSTRAINT `knowledge_base_categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `knowledge_base_categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `knowledge_base_categories`
--


--
-- Table structure for table `knowledge_base_ratings`
--

CREATE TABLE `knowledge_base_ratings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `article_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `rating` int NOT NULL,
  `helpful` tinyint(1) NOT NULL,
  `feedback` text COLLATE utf8mb4_unicode_ci,
  `ip_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `knowledge_base_ratings_article_id_user_id_unique` (`article_id`,`user_id`),
  KEY `knowledge_base_ratings_user_id_foreign` (`user_id`),
  CONSTRAINT `knowledge_base_ratings_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `knowledge_base_articles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `knowledge_base_ratings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `knowledge_base_ratings`
--


--
-- Table structure for table `lead_activities`
--

CREATE TABLE `lead_activities` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lead_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `performed_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `lead_activities_performed_by_foreign` (`performed_by`),
  KEY `lead_activities_lead_id_created_at_index` (`lead_id`,`created_at`),
  CONSTRAINT `lead_activities_lead_id_foreign` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE,
  CONSTRAINT `lead_activities_performed_by_foreign` FOREIGN KEY (`performed_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lead_activities`
--


--
-- Table structure for table `lead_communications`
--

CREATE TABLE `lead_communications` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lead_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `direction` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'OUTBOUND',
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `content` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'SENT',
  `scheduled_at` datetime DEFAULT NULL,
  `sent_at` datetime DEFAULT NULL,
  `delivered_at` datetime DEFAULT NULL,
  `opened_at` datetime DEFAULT NULL,
  `clicked_at` datetime DEFAULT NULL,
  `replied_at` datetime DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `lead_communications_lead_id_index` (`lead_id`),
  KEY `lead_communications_status_index` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lead_communications`
--


--
-- Table structure for table `leads`
--

CREATE TABLE `leads` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lead_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `source` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'WEBSITE',
  `campaign_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NEW',
  `score` int NOT NULL DEFAULT '0',
  `priority` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MEDIUM',
  `estimated_value` double DEFAULT NULL,
  `assigned_to` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `leads_lead_number_unique` (`lead_number`),
  KEY `leads_customer_id_foreign` (`customer_id`),
  KEY `leads_campaign_id_foreign` (`campaign_id`),
  KEY `leads_assigned_to_foreign` (`assigned_to`),
  CONSTRAINT `leads_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leads_campaign_id_foreign` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leads_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `leads`
--


--
-- Table structure for table `leave_requests`
--

CREATE TABLE `leave_requests` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `leave_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `total_days` int NOT NULL,
  `reason` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `admin_notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `leave_requests_user_id_foreign` (`user_id`),
  KEY `leave_requests_approved_by_foreign` (`approved_by`),
  CONSTRAINT `leave_requests_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leave_requests_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `leave_requests`
--


--
-- Table structure for table `maintenance_parts`
--

CREATE TABLE `maintenance_parts` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `part_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `cost` double NOT NULL,
  `price` double NOT NULL,
  `quantity` int NOT NULL DEFAULT '0',
  `min_stock` int NOT NULL DEFAULT '0',
  `max_stock` int DEFAULT NULL,
  `location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `supplier` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'AVAILABLE',
  `barcode` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `maintenance_parts_part_number_unique` (`part_number`),
  KEY `maintenance_parts_created_by_foreign` (`created_by`),
  KEY `maintenance_parts_part_number_index` (`part_number`),
  KEY `maintenance_parts_category_index` (`category`),
  KEY `maintenance_parts_status_index` (`status`),
  CONSTRAINT `maintenance_parts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `maintenance_parts`
--


--
-- Table structure for table `maintenance_records`
--

CREATE TABLE `maintenance_records` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `schedule_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `cost` double NOT NULL,
  `technician` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'IN_PROGRESS',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `parts` json DEFAULT NULL,
  `labor_hours` double DEFAULT NULL,
  `odometer` int DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `maintenance_records_schedule_id_foreign` (`schedule_id`),
  KEY `maintenance_records_created_by_foreign` (`created_by`),
  KEY `maintenance_records_vehicle_id_index` (`vehicle_id`),
  KEY `maintenance_records_status_index` (`status`),
  CONSTRAINT `maintenance_records_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `maintenance_records_schedule_id_foreign` FOREIGN KEY (`schedule_id`) REFERENCES `maintenance_schedules` (`id`) ON DELETE SET NULL,
  CONSTRAINT `maintenance_records_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `maintenance_records`
--


--
-- Table structure for table `maintenance_reminders`
--

CREATE TABLE `maintenance_reminders` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `schedule_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `reminder_date` datetime NOT NULL,
  `sent_date` datetime DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `maintenance_reminders_schedule_id_foreign` (`schedule_id`),
  KEY `maintenance_reminders_vehicle_id_foreign` (`vehicle_id`),
  KEY `maintenance_reminders_created_by_foreign` (`created_by`),
  KEY `maintenance_reminders_reminder_date_index` (`reminder_date`),
  CONSTRAINT `maintenance_reminders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `maintenance_reminders_schedule_id_foreign` FOREIGN KEY (`schedule_id`) REFERENCES `maintenance_schedules` (`id`),
  CONSTRAINT `maintenance_reminders_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `maintenance_reminders`
--


--
-- Table structure for table `maintenance_schedules`
--

CREATE TABLE `maintenance_schedules` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `interval` int NOT NULL,
  `interval_km` int DEFAULT NULL,
  `last_service` datetime DEFAULT NULL,
  `next_service` datetime NOT NULL,
  `estimated_cost` double DEFAULT NULL,
  `priority` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `maintenance_schedules_created_by_foreign` (`created_by`),
  KEY `maintenance_schedules_vehicle_id_index` (`vehicle_id`),
  KEY `maintenance_schedules_next_service_index` (`next_service`),
  CONSTRAINT `maintenance_schedules_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `maintenance_schedules_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `maintenance_schedules`
--


--
-- Table structure for table `maintenance_usage_items`
--

CREATE TABLE `maintenance_usage_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `maintenance_record_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quantity` int NOT NULL DEFAULT '1',
  `batch_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT '0.00',
  `total_cost` decimal(15,2) NOT NULL DEFAULT '0.00',
  `is_stock_deducted` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `maintenance_usage_items_maintenance_record_id_foreign` (`maintenance_record_id`),
  KEY `maintenance_usage_items_product_id_foreign` (`product_id`),
  CONSTRAINT `maintenance_usage_items_maintenance_record_id_foreign` FOREIGN KEY (`maintenance_record_id`) REFERENCES `maintenance_records` (`id`) ON DELETE CASCADE,
  CONSTRAINT `maintenance_usage_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `maintenance_usage_items`
--


--
-- Table structure for table `marketing_automations`
--

CREATE TABLE `marketing_automations` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `campaign_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `trigger_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `trigger_config` json DEFAULT NULL,
  `action_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `action_config` json DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `delay_minutes` int NOT NULL DEFAULT '0',
  `executions_count` int NOT NULL DEFAULT '0',
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `marketing_automations_campaign_id_foreign` (`campaign_id`),
  CONSTRAINT `marketing_automations_campaign_id_foreign` FOREIGN KEY (`campaign_id`) REFERENCES `marketing_campaigns` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `marketing_automations`
--


--
-- Table structure for table `marketing_campaigns`
--

CREATE TABLE `marketing_campaigns` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `start_date` datetime NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `budget` double DEFAULT NULL,
  `target_audience` json DEFAULT NULL,
  `content` json DEFAULT NULL,
  `channels` json DEFAULT NULL,
  `goals` json DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tags` json DEFAULT NULL,
  `attachments` json DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `marketing_campaigns_branch_id_foreign` (`branch_id`),
  KEY `marketing_campaigns_type_status_index` (`type`,`status`),
  KEY `marketing_campaigns_created_by_index` (`created_by`),
  CONSTRAINT `marketing_campaigns_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `marketing_campaigns_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `marketing_campaigns`
--


--
-- Table structure for table `marketing_metrics`
--

CREATE TABLE `marketing_metrics` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` datetime NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DAILY',
  `campaigns_sent` int NOT NULL DEFAULT '0',
  `emails_sent` int NOT NULL DEFAULT '0',
  `emails_opened` int NOT NULL DEFAULT '0',
  `emails_clicked` int NOT NULL DEFAULT '0',
  `sms_sent` int NOT NULL DEFAULT '0',
  `sms_delivered` int NOT NULL DEFAULT '0',
  `leads_generated` int NOT NULL DEFAULT '0',
  `leads_converted` int NOT NULL DEFAULT '0',
  `conversion_rate` double NOT NULL DEFAULT '0',
  `cost_per_lead` double NOT NULL DEFAULT '0',
  `cost_per_acquisition` double NOT NULL DEFAULT '0',
  `revenue_generated` double NOT NULL DEFAULT '0',
  `roi` double NOT NULL DEFAULT '0',
  `top_campaigns` json DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `marketing_metrics_date_period_branch_id_unique` (`date`,`period`,`branch_id`),
  KEY `marketing_metrics_date_period_index` (`date`,`period`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `marketing_metrics`
--


--
-- Table structure for table `media`
--

CREATE TABLE `media` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `thumbnail_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mime_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `size` int NOT NULL,
  `width` int DEFAULT NULL,
  `height` int DEFAULT NULL,
  `alt_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `tags` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'other',
  `entity_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_public` tinyint(1) NOT NULL DEFAULT '1',
  `is_featured` tinyint(1) NOT NULL DEFAULT '0',
  `order` int NOT NULL DEFAULT '0',
  `metadata` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `media_created_by_foreign` (`created_by`),
  CONSTRAINT `media_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `media`
--


--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES (1,'0001_01_01_000000_create_users_table',1),(2,'0001_01_01_000001_create_cache_table',1),(3,'0001_01_01_000002_create_jobs_table',1),(4,'2024_01_01_000001_create_organization_tables',1),(5,'2024_01_01_000002_create_vehicles_tables',1),(6,'2024_01_01_000003_create_bookings_tables',1),(7,'2024_01_01_000004_create_finance_tables',1),(8,'2024_01_01_000005_create_crm_tables',1),(9,'2024_01_01_000006_create_support_tables',1),(10,'2024_01_01_000007_create_cms_tables',1),(11,'2024_01_01_000008_create_logistics_tables',1),(12,'2026_02_16_111651_create_employee_profiles_table',2),(13,'2026_02_16_111653_create_leave_requests_table',2),(14,'2026_02_16_111655_create_payroll_records_table',2),(16,'2026_02_16_121513_create_contact_messages_table',3),(17,'2026_02_16_160001_create_finance_accounting_tables',4),(18,'2026_02_16_160002_create_hr_personnel_tables',4),(19,'2026_02_16_160003_create_crm_sales_tables',4),(20,'2026_02_16_160004_create_support_insurance_tables',4),(21,'2026_02_16_160005_create_maintenance_commerce_contract_tables',4),(22,'2026_02_16_180000_add_soft_deletes_to_critical_tables',5),(23,'2026_02_16_150000_add_features_to_vehicles_table',6),(24,'2026_02_16_160006_create_system_cms_tables',6),(25,'2026_02_16_180100_create_activity_logs_table',7),(26,'2026_02_17_114630_create_faqs_table',7),(27,'2026_02_17_120000_create_company_infos_table',8),(28,'2026_02_17_190000_add_api_token_to_users_table',9),(29,'2026_02_17_190700_create_suppliers_table',9),(30,'2026_02_17_190701_create_purchase_orders_table',9),(31,'2026_02_17_190702_create_goods_receipts_table',9),(32,'2026_02_17_190705_create_purchase_order_items_table',9),(33,'2026_02_17_191000_add_approval_fields_to_leave_requests_table',9),(34,'2026_02_17_192000_add_search_indexes',9),(35,'2026_02_17_190821_create_goods_receipt_items_table',10),(36,'2026_02_17_191355_create_bills_table',11),(37,'2026_02_17_192240_create_maintenance_usage_items_table',12),(38,'2026_02_17_192431_add_cost_price_to_products_table',13),(39,'2026_02_17_212147_add_cost_price_to_products_table',13),(40,'2026_02_17_192944_add_score_to_leads_table',14),(42,'2026_02_17_193355_create_audit_logs_table',15),(43,'2026_02_17_200000_add_inventory_tracking_columns',15);

--
-- Table structure for table `opportunities`
--

CREATE TABLE `opportunities` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `stage` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'LEAD',
  `value` double NOT NULL DEFAULT '0',
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `probability` int NOT NULL DEFAULT '0',
  `expected_close_date` datetime DEFAULT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `opportunities_customer_id_foreign` (`customer_id`),
  KEY `opportunities_vehicle_id_foreign` (`vehicle_id`),
  CONSTRAINT `opportunities_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customer_profiles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `opportunities_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `opportunities`
--


--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `order_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` int NOT NULL,
  `price` double NOT NULL,
  `total_price` double NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `order_items_order_id_foreign` (`order_id`),
  KEY `order_items_product_id_foreign` (`product_id`),
  CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE,
  CONSTRAINT `order_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_items`
--


--
-- Table structure for table `order_payments`
--

CREATE TABLE `order_payments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `order_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `payment_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `transaction_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `receipt_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `order_payments_order_id_foreign` (`order_id`),
  KEY `order_payments_status_index` (`status`),
  CONSTRAINT `order_payments_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_payments`
--


--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `order_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `subtotal` double NOT NULL,
  `tax_amount` double NOT NULL DEFAULT '0',
  `shipping_amount` double NOT NULL DEFAULT '0',
  `total` double NOT NULL,
  `shipping_address` json NOT NULL,
  `billing_address` json DEFAULT NULL,
  `payment_method` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `orders_order_number_unique` (`order_number`),
  KEY `orders_customer_id_foreign` (`customer_id`),
  KEY `orders_created_by_foreign` (`created_by`),
  KEY `orders_order_number_index` (`order_number`),
  KEY `orders_status_index` (`status`),
  CONSTRAINT `orders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `orders_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `orders`
--


--
-- Table structure for table `page_seo`
--

CREATE TABLE `page_seo` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `page_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `keywords` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `og_image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `no_index` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `page_seo_page_path_unique` (`page_path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `page_seo`
--


--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `booking_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `booking_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'SERVICE',
  `amount` double NOT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `payment_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `transaction_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `receipt_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `invoice_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `service_booking_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `test_drive_booking_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `payments_branch_id_foreign` (`branch_id`),
  KEY `payments_service_booking_id_foreign` (`service_booking_id`),
  KEY `payments_test_drive_booking_id_foreign` (`test_drive_booking_id`),
  KEY `payments_transaction_idx` (`transaction_id`),
  KEY `payments_customer_idx` (`customer_id`),
  KEY `payments_invoice_idx` (`invoice_id`),
  CONSTRAINT `payments_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `payments_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `payments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE SET NULL,
  CONSTRAINT `payments_service_booking_id_foreign` FOREIGN KEY (`service_booking_id`) REFERENCES `service_bookings` (`id`) ON DELETE SET NULL,
  CONSTRAINT `payments_test_drive_booking_id_foreign` FOREIGN KEY (`test_drive_booking_id`) REFERENCES `test_drive_bookings` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` VALUES ('019c5d5f-0579-700c-bffb-4d5b771d5e5e',NULL,'SERVICE',570,'EGP','COMPLETED','CASH','TXN-VERIFY-1771093034',NULL,NULL,NULL,NULL,'019c5d5f-0562-7188-a8d0-5d9f2b26de1e','019c5d5f-0576-738e-a1a8-901181b93479',NULL,NULL,'2026-02-14 16:17:14','2026-02-14 16:17:14',NULL);

--
-- Table structure for table `payroll_records`
--

CREATE TABLE `payroll_records` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `basic_salary` decimal(10,2) NOT NULL,
  `allowances` decimal(10,2) NOT NULL DEFAULT '0.00',
  `deductions` decimal(10,2) NOT NULL DEFAULT '0.00',
  `net_salary` decimal(10,2) NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `paid_date` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `payroll_records_user_id_foreign` (`user_id`),
  CONSTRAINT `payroll_records_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payroll_records`
--


--
-- Table structure for table `performance_metrics`
--

CREATE TABLE `performance_metrics` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `employee_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `period_label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CURRENT',
  `bookings_handled` int NOT NULL DEFAULT '0',
  `average_handling_time` double NOT NULL DEFAULT '0',
  `customer_rating` double NOT NULL DEFAULT '0',
  `conversion_rate` double NOT NULL DEFAULT '0',
  `revenue_generated` double NOT NULL DEFAULT '0',
  `tasks_completed` int NOT NULL DEFAULT '0',
  `customer_satisfaction` double NOT NULL DEFAULT '0',
  `response_time` double NOT NULL DEFAULT '0',
  `follow_up_rate` double NOT NULL DEFAULT '0',
  `upsell_success` double NOT NULL DEFAULT '0',
  `overall_score` double NOT NULL DEFAULT '0',
  `metrics_metadata` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `performance_metrics_employee_id_period_period_label_unique` (`employee_id`,`period`,`period_label`),
  CONSTRAINT `performance_metrics_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `performance_metrics`
--


--
-- Table structure for table `performance_reviews`
--

CREATE TABLE `performance_reviews` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `employee_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reviewer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `rating` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `goals` json DEFAULT NULL,
  `achievements` json DEFAULT NULL,
  `areas_for_improvement` json DEFAULT NULL,
  `comments` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `performance_reviews_reviewer_id_foreign` (`reviewer_id`),
  KEY `performance_reviews_employee_id_period_index` (`employee_id`,`period`),
  CONSTRAINT `performance_reviews_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  CONSTRAINT `performance_reviews_reviewer_id_foreign` FOREIGN KEY (`reviewer_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `performance_reviews`
--


--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` VALUES ('019c67cc-c1b6-73ef-b22e-584b4c720dc6','access_admin_panel','الوصول للوحة الإدارة','system',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1b9-7369-bd83-7be29d79c9f5','manage_users','إدارة المستخدمين','system',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1bf-707d-b7e3-a16cebe1bebc','manage_invoices','إدارة الفواتير','finance',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1c1-72d3-b327-24d6cc91f6a5','manage_bookings','إدارة الحجوزات','bookings',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1c4-7340-8830-d121975c322b','manage_vehicles','إدارة المركبات','vehicles',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1c7-7316-965c-a1c577701dfd','manage_hr','إدارة الموارد البشرية','hr',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1c9-716f-ac97-d6ab11eba5ff','manage_reports','عرض التقارير','reports',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1ce-72a3-aa28-74c2e227dc02','manage_marketing','إدارة التسويق','marketing',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1d1-7102-bd09-3a06e9e4a689','manage_support','إدارة الدعم الفني','support',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1d3-722a-8387-39a5adeac5c2','manage_settings','إدارة الإعدادات','system',1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67d7-84f5-7228-b616-f71b7fb25832','vehicles.view','عرض المركبات','VEHICLE_MANAGEMENT',1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('019c67d7-84ff-701e-9d53-d4828908e7ad','vehicles.create','إنشاء مركبات','VEHICLE_MANAGEMENT',1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('019c67d7-8502-71a6-87fa-9f00f5ca7a15','vehicles.edit','تعديل المركبات','VEHICLE_MANAGEMENT',1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('019c67d7-8505-70eb-9cf1-0360db4e80eb','vehicles.delete','حذف المركبات','VEHICLE_MANAGEMENT',1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('019c67d7-8508-71e4-973f-17d438d2a813','bookings.view','عرض الحجوزات','BOOKING_MANAGEMENT',1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('019c67d7-850c-72a1-96a0-5c8392765cad','admin.dashboard','لوحة التحكم','SYSTEM_SETTINGS',1,'2026-02-16 17:05:03','2026-02-16 17:05:03');

--
-- Table structure for table `popup_configs`
--

CREATE TABLE `popup_configs` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `content` text COLLATE utf8mb4_unicode_ci,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `link_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `button_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `button_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#3b82f6',
  `text_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#ffffff',
  `background_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#1f2937',
  `position` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'BOTTOM_RIGHT',
  `show_delay` int NOT NULL DEFAULT '3000',
  `auto_hide` tinyint(1) NOT NULL DEFAULT '1',
  `hide_delay` int NOT NULL DEFAULT '10000',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `show_on_pages` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'homepage',
  `target_audience` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'all',
  `start_date` datetime DEFAULT NULL,
  `end_date` datetime DEFAULT NULL,
  `priority` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `popup_configs`
--


--
-- Table structure for table `positions`
--

CREATE TABLE `positions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `department_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `level` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'JUNIOR',
  `description` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `positions_title_department_id_unique` (`title`,`department_id`),
  KEY `positions_department_id_foreign` (`department_id`),
  CONSTRAINT `positions_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `positions`
--

INSERT INTO `positions` VALUES ('019c67cc-c191-7047-87d1-7e7a7cc9aff9','مدير عام','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c196-73da-8112-02b9456dcc7b','مدير مبيعات','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c199-70f6-8580-ff6ba6184083','محاسب','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c19e-7385-ada3-bf83450d28d2','فني صيانة','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1a1-722c-b51a-b24dd7ff4c7d','مندوب مبيعات','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1a4-73e5-a428-91cec3d79391','مسؤول تسويق','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1a7-7098-80d9-d3bf051ccd0b','مسؤول موارد بشرية','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1ab-70d3-9913-0f9ed2bd04fc','مسؤول خدمة عملاء','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1af-70f3-b1d2-2b6ad7fe9079','مبرمج','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18'),('019c67cc-c1b2-7196-b772-e5ae383a475f','مدير فرع','019c67cc-c16a-716f-9b19-41c9cf4c5778','SENIOR',NULL,1,'2026-02-16 16:53:18','2026-02-16 16:53:18');

--
-- Table structure for table `product_reviews`
--

CREATE TABLE `product_reviews` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `rating` int NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `review` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `images` json DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `is_anonymous` tinyint(1) NOT NULL DEFAULT '0',
  `helpful` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_reviews_product_id_foreign` (`product_id`),
  KEY `product_reviews_customer_id_foreign` (`customer_id`),
  KEY `product_reviews_rating_index` (`rating`),
  KEY `product_reviews_status_index` (`status`),
  CONSTRAINT `product_reviews_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `product_reviews_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_reviews`
--


--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `price` double NOT NULL,
  `cost_price` decimal(15,2) NOT NULL DEFAULT '0.00',
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `images` json NOT NULL,
  `in_stock` tinyint(1) NOT NULL DEFAULT '1',
  `quantity` int NOT NULL DEFAULT '0',
  `bin_location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `featured` tinyint(1) NOT NULL DEFAULT '0',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `products_created_by_foreign` (`created_by`),
  KEY `products_name_index` (`name`),
  KEY `products_category_index` (`category`),
  KEY `products_status_index` (`status`),
  CONSTRAINT `products_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products`
--


--
-- Table structure for table `promotion_usages`
--

CREATE TABLE `promotion_usages` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `promotion_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `order_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `discount` double NOT NULL,
  `used_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `promotion_usages_promotion_id_foreign` (`promotion_id`),
  KEY `promotion_usages_order_id_foreign` (`order_id`),
  CONSTRAINT `promotion_usages_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
  CONSTRAINT `promotion_usages_promotion_id_foreign` FOREIGN KEY (`promotion_id`) REFERENCES `promotions` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `promotion_usages`
--


--
-- Table structure for table `promotions`
--

CREATE TABLE `promotions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` double NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `usage_limit` int NOT NULL,
  `used_count` int NOT NULL DEFAULT '0',
  `active` tinyint(1) NOT NULL DEFAULT '1',
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `promotions_code_unique` (`code`),
  KEY `promotions_created_by_foreign` (`created_by`),
  KEY `promotions_code_index` (`code`),
  KEY `promotions_active_index` (`active`),
  CONSTRAINT `promotions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `promotions`
--


--
-- Table structure for table `purchase_order_items`
--

CREATE TABLE `purchase_order_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `purchase_order_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `product_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quantity_ordered` int NOT NULL DEFAULT '0',
  `unit_price` decimal(15,2) NOT NULL DEFAULT '0.00',
  `total_price` decimal(15,2) NOT NULL DEFAULT '0.00',
  `quantity_received` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_order_items_purchase_order_id_foreign` (`purchase_order_id`),
  KEY `purchase_order_items_product_id_foreign` (`product_id`),
  CONSTRAINT `purchase_order_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `purchase_order_items_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_order_items`
--


--
-- Table structure for table `purchase_orders`
--

CREATE TABLE `purchase_orders` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `order_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `supplier_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `order_date` date NOT NULL,
  `expected_delivery_date` date DEFAULT NULL,
  `total_amount` decimal(15,2) NOT NULL DEFAULT '0.00',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `purchase_orders_order_number_unique` (`order_number`),
  KEY `purchase_orders_supplier_id_foreign` (`supplier_id`),
  KEY `purchase_orders_created_by_foreign` (`created_by`),
  KEY `purchase_orders_approved_by_foreign` (`approved_by`),
  CONSTRAINT `purchase_orders_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`),
  CONSTRAINT `purchase_orders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `purchase_orders_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_orders`
--


--
-- Table structure for table `quotation_items`
--

CREATE TABLE `quotation_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `quotation_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` int NOT NULL DEFAULT '1',
  `unit_price` double NOT NULL DEFAULT '0',
  `total_price` double NOT NULL DEFAULT '0',
  `tax_rate` double NOT NULL DEFAULT '0',
  `tax_amount` double NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `quotation_items_quotation_id_foreign` (`quotation_id`),
  CONSTRAINT `quotation_items_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotation_items`
--


--
-- Table structure for table `quotations`
--

CREATE TABLE `quotations` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `quotation_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
  `issue_date` datetime NOT NULL,
  `valid_until` datetime NOT NULL,
  `subtotal` double NOT NULL DEFAULT '0',
  `tax_amount` double NOT NULL DEFAULT '0',
  `total_amount` double NOT NULL DEFAULT '0',
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `terms` text COLLATE utf8mb4_unicode_ci,
  `created_by_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `converted_to_invoice_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `quotations_quotation_number_unique` (`quotation_number`),
  UNIQUE KEY `quotations_converted_to_invoice_id_unique` (`converted_to_invoice_id`),
  KEY `quotations_customer_id_foreign` (`customer_id`),
  KEY `quotations_branch_id_foreign` (`branch_id`),
  KEY `quotations_created_by_id_foreign` (`created_by_id`),
  CONSTRAINT `quotations_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `quotations_converted_to_invoice_id_foreign` FOREIGN KEY (`converted_to_invoice_id`) REFERENCES `invoices` (`id`),
  CONSTRAINT `quotations_created_by_id_foreign` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`),
  CONSTRAINT `quotations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotations`
--


--
-- Table structure for table `role_template_permissions`
--

CREATE TABLE `role_template_permissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `template_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `permission_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `role_template_permissions_template_id_permission_id_unique` (`template_id`,`permission_id`),
  KEY `role_template_permissions_permission_id_foreign` (`permission_id`),
  CONSTRAINT `role_template_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_template_permissions_template_id_foreign` FOREIGN KEY (`template_id`) REFERENCES `role_templates` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_template_permissions`
--


--
-- Table structure for table `role_templates`
--

CREATE TABLE `role_templates` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `role` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `permissions` json NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `is_system` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `role_templates_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_templates`
--

INSERT INTO `role_templates` VALUES ('84a39853-c5e4-4e19-87be-60b8576e0963','Customer','عميل','CUSTOMER','[]',1,1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('89d0fb39-9240-4654-a252-09702b901796','Branch Manager','مدير فرع','BRANCH_MANAGER','[]',1,1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('9e6a0f74-3b89-452d-9e49-a96254a5faa5','Staff','موظف','STAFF','[]',1,1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('a33d2d1b-8be5-4a71-b790-724ec50a3d91','Super Admin','المدير العام','SUPER_ADMIN','[]',1,1,'2026-02-16 17:05:03','2026-02-16 17:05:03'),('b8c2aafd-13a1-488e-a8f4-ef348af392a3','Admin','مدير','ADMIN','[]',1,1,'2026-02-16 17:05:03','2026-02-16 17:05:03');

--
-- Table structure for table `salary_advances`
--

CREATE TABLE `salary_advances` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `employee_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `requested_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `reason` text COLLATE utf8mb4_unicode_ci,
  `requested_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `disbursed_at` datetime DEFAULT NULL,
  `repayment_start` datetime DEFAULT NULL,
  `repayment_months` int DEFAULT NULL,
  `repayment_schedule` json DEFAULT NULL,
  `repaid_amount` double NOT NULL DEFAULT '0',
  `next_due_date` datetime DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `salary_advances_requested_by_foreign` (`requested_by`),
  KEY `salary_advances_approved_by_foreign` (`approved_by`),
  KEY `salary_advances_employee_id_status_index` (`employee_id`,`status`),
  CONSTRAINT `salary_advances_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `salary_advances_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  CONSTRAINT `salary_advances_requested_by_foreign` FOREIGN KEY (`requested_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `salary_advances`
--


--
-- Table structure for table `sales_funnels`
--

CREATE TABLE `sales_funnels` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `stages` json NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `is_default` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sales_funnels_created_by_foreign` (`created_by`),
  KEY `sales_funnels_branch_id_foreign` (`branch_id`),
  KEY `sales_funnels_is_active_index` (`is_active`),
  CONSTRAINT `sales_funnels_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `sales_funnels_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sales_funnels`
--


--
-- Table structure for table `sales_targets`
--

CREATE TABLE `sales_targets` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'REVENUE',
  `target_value` double NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MONTHLY',
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `assigned_to` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `assigned_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'USER',
  `progress` double NOT NULL DEFAULT '0',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sales_targets_assigned_to_index` (`assigned_to`),
  KEY `sales_targets_start_date_index` (`start_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sales_targets`
--


--
-- Table structure for table `security_logs`
--

CREATE TABLE `security_logs` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `severity` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'INFO',
  `description` text COLLATE utf8mb4_unicode_ci,
  `ip_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `security_logs_user_id_index` (`user_id`),
  KEY `security_logs_action_index` (`action`),
  KEY `security_logs_created_at_index` (`created_at`),
  CONSTRAINT `security_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `security_logs`
--


--
-- Table structure for table `service_booking_submissions`
--

CREATE TABLE `service_booking_submissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `service_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `preferred_date` datetime NOT NULL,
  `preferred_time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `submitted_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `service_booking_submissions`
--


--
-- Table structure for table `service_bookings`
--

CREATE TABLE `service_bookings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `service_type_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `time_slot_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date` datetime NOT NULL,
  `time_slot` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `total_price` double DEFAULT NULL,
  `payment_status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `payment_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reminder_sent` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `service_bookings_customer_id_foreign` (`customer_id`),
  KEY `service_bookings_vehicle_id_foreign` (`vehicle_id`),
  KEY `service_bookings_service_type_id_foreign` (`service_type_id`),
  KEY `service_bookings_time_slot_id_foreign` (`time_slot_id`),
  CONSTRAINT `service_bookings_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `service_bookings_service_type_id_foreign` FOREIGN KEY (`service_type_id`) REFERENCES `service_types` (`id`) ON DELETE CASCADE,
  CONSTRAINT `service_bookings_time_slot_id_foreign` FOREIGN KEY (`time_slot_id`) REFERENCES `time_slots` (`id`) ON DELETE SET NULL,
  CONSTRAINT `service_bookings_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `service_bookings`
--

INSERT INTO `service_bookings` VALUES ('019c5d5f-0572-7069-88ba-262bd951d1c1','019c5d5f-0562-7188-a8d0-5d9f2b26de1e','019c5d5f-056c-720e-9ce9-ec49aa2715e9','019c5d5f-0568-7055-8865-89f932d3e452',NULL,'2026-02-16 18:17:14','02:00 PM','PENDING',NULL,NULL,'PENDING',NULL,0,'2026-02-14 16:17:14','2026-02-14 16:17:14');

--
-- Table structure for table `service_evaluations`
--

CREATE TABLE `service_evaluations` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `service_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `service_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `overall_rating` int NOT NULL DEFAULT '0',
  `quality_rating` int DEFAULT NULL,
  `speed_rating` int DEFAULT NULL,
  `staff_rating` int DEFAULT NULL,
  `value_rating` int DEFAULT NULL,
  `recommendations` text COLLATE utf8mb4_unicode_ci,
  `would_recommend` tinyint(1) DEFAULT NULL,
  `feedback` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `reviewed_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reviewed_at` datetime DEFAULT NULL,
  `response` text COLLATE utf8mb4_unicode_ci,
  `tags` json DEFAULT NULL,
  `attachments` json DEFAULT NULL,
  `is_public` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `service_evaluations_customer_id_index` (`customer_id`),
  KEY `service_evaluations_overall_rating_index` (`overall_rating`),
  KEY `service_evaluations_status_index` (`status`),
  CONSTRAINT `service_evaluations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `service_evaluations`
--


--
-- Table structure for table `service_items`
--

CREATE TABLE `service_items` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `price` double DEFAULT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `service_items`
--

INSERT INTO `service_items` VALUES ('019c67fe-9b93-7050-ba39-32e08ba1da2b','صيانة دورية','صيانة دورية شاملة للشاحنات والمركبات التجارية','fas fa-wrench',NULL,NULL,NULL,1,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b95-7179-ac5b-f9743f93365e','قطع غيار أصلية','توفير قطع غيار أصلية من تاتا موتورز','fas fa-box',NULL,NULL,NULL,2,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b98-7016-9813-7f0e5518e0a8','خدمة 24 ساعة','خدمة طوارئ على مدار الساعة طوال أيام الأسبوع','fas fa-clock',NULL,NULL,NULL,3,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b9b-73a4-bc18-91ed6fb9d579','التأجير','تأجير شاحنات ومركبات تجارية للشركات والأفراد','fas fa-truck',NULL,NULL,NULL,4,1,'2026-02-16 17:47:45','2026-02-16 17:47:45');

--
-- Table structure for table `service_types`
--

CREATE TABLE `service_types` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `duration` int NOT NULL,
  `price` double DEFAULT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `service_types`
--

INSERT INTO `service_types` VALUES ('019c5d5f-0568-7055-8865-89f932d3e452','Verification Service','Service for verification',60,500,'General Maintenance',1,'2026-02-14 16:17:14','2026-02-14 16:17:14'),('019c67e7-cd66-7050-b69d-8f7c9e53c96c','صيانة دورية','صيانة دورية شاملة للمركبات',120,500,'MAINTENANCE',1,'2026-02-16 17:22:50','2026-02-16 17:22:50'),('019c67e7-cd83-714a-830f-14e25c8a3cf8','تصليح مكابح','صيانة وإصلاح نظام المكابح',180,800,'REPAIR',1,'2026-02-16 17:22:50','2026-02-16 17:22:50'),('019c67e7-cd86-73b9-b2ee-cf65c102716a','تغيير إطارات','تغيير وترصيص الإطارات',90,400,'MAINTENANCE',1,'2026-02-16 17:22:50','2026-02-16 17:22:50'),('37476a6a-cb74-43cb-a782-206629eb8b77','فحص كمبيوتر','فحص بالكمبيوتر',30,200,'INSPECTION',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('514d53de-2a45-40e2-a9fe-63a2ceccfcc7','غسيل كامل','غسيل داخلي وخارجي',45,150,'WASH',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('6950a1f0-2696-4cb0-84b2-34d770243c20','تظليل','تظليل زجاج المركبة',120,1500,'ACCESSORIES',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('8297613d-8076-4e32-8c89-72e3941ac613','صيانة فرامل','فحص وتبديل الفرامل',90,600,'MAINTENANCE',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('87db48ad-d0f5-4b09-b450-0cfa7890ee58','تجربة قيادة','تجربة قيادة لمركبة جديدة',30,0,'TEST_DRIVE',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('8ea41c9a-5274-49ee-86c1-ff57c56a18c4','تلميع','تلميع وبوليش كامل',180,800,'WASH',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('a2be5b0f-14af-4805-a608-95de854e8a8d','فحص شامل','فحص شامل للمركبة',60,500,'INSPECTION',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('a9ed759e-a9ce-4c31-985b-8a023cb2ab67','تبديل إطارات','تبديل 4 إطارات',60,2000,'MAINTENANCE',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('bfce2242-e84b-41b5-ad20-dae71c6e3d94','ترخيص','خدمة ترخيص المركبة',120,350,'GOVERNMENT',1,'2026-02-16 16:53:20','2026-02-16 16:53:20'),('c45d1507-466e-4bb4-b396-6675ccde49b8','تغيير زيت','تغيير زيت المحرك والفلتر',30,250,'MAINTENANCE',1,'2026-02-16 16:53:20','2026-02-16 16:53:20');

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` VALUES ('5MMaFRmDQfjq0iXtX3LYUB9tcqGg1BEuw4VsQQ4m',NULL,'127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0','YTozOntzOjY6Il90b2tlbiI7czo0MDoiaUZQRzRFMlBEaW9ObkdISzBORjRVd29CVUZsZGNDTXhOSTVWaEd0RCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=',1771345030),('5Vse526oFx4etxqLndYLjhxQKLkLPoVXlyaoY8Wz','9088e433-1ffe-4a51-81d1-b001b40d868d','127.0.0.1','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','YTo0OntzOjY6Il90b2tlbiI7czo0MDoicGFOREJ2cVJOczNGSmRCajB3cEJKNXZjU0dLQm5na3k1NG5hSkc5dCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NDA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9hZG1pbi9jbXMvc2V0dGluZ3MiO3M6NToicm91dGUiO3M6MjQ6ImFkbWluLmNtcy5zZXR0aW5ncy5pbmRleCI7fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtzOjM2OiI5MDg4ZTQzMy0xZmZlLTRhNTEtODFkMS1iMDAxYjQwZDg2OGQiO30=',1771350246);

--
-- Table structure for table `site_settings`
--

CREATE TABLE `site_settings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `site_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Elhamd Auto',
  `site_description` text COLLATE utf8mb4_unicode_ci,
  `logo_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `favicon_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_address` text COLLATE utf8mb4_unicode_ci,
  `primary_color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#0A1A3F',
  `social_links` json DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `site_settings`
--

INSERT INTO `site_settings` VALUES ('db3cd2f0-c7c7-4910-aaba-eec3daf341a8','الحمد للسيارات','الموزع المعتمد لسيارات تاتا موتورز في مدن القناة - نقدم أفضل خدمات السيارات التجارية وحلول النقل الموثوقة.','/uploads/logo/elhamd-logo.png',NULL,'info@elhamdimport.online','+201555767729','بورسعيد - الحي الإماراتي','#2563eb','{\"facebook\": \"https://facebook.com/elhamdcars\", \"whatsapp\": \"https://wa.me/201555767729\", \"instagram\": null}',1,'2026-02-16 16:58:46','2026-02-17 10:58:04'),('default','شركة الحمد لاستيراد السيارات','الموزع المعتمد لسيارات تاتا في مدن القناة',NULL,NULL,'info@elhamdimport.online',NULL,NULL,'#0A1A3F',NULL,1,'2026-02-16 17:28:30','2026-02-16 17:28:30');

--
-- Table structure for table `sliders`
--

CREATE TABLE `sliders` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subtitle` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `cta_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cta_link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sliders`
--

INSERT INTO `sliders` VALUES ('019c6ba3-0588-73ae-8b3c-56bbe64c57a0','الحمد للسيارات التجارية','الموزع المعتمد لسيارات تاتا موتورز في مدن القناة',NULL,'/uploads/sliders/slider-slider-0.jpeg','استعرض المركبات','/vehicles',1,1,'2026-02-17 10:46:11','2026-02-17 10:46:11'),('019c6ba3-0594-7145-9e18-fb36e13dac42','شاحنات تاتا PRIMA','القوة والموثوقية في النقل الثقيل',NULL,'/uploads/sliders/slider-slider-1.jpeg','اكتشف المزيد','/vehicles',2,1,'2026-02-17 10:46:11','2026-02-17 10:46:11'),('019c6ba3-059a-71e8-adfa-8888c1ac055a','خدمات متكاملة','صيانة وقطع غيار أصلية على مدار الساعة',NULL,'/uploads/sliders/slider-slider-2.jpeg','احجز موعد صيانة','/service-booking',3,1,'2026-02-17 10:46:11','2026-02-17 10:46:11');

--
-- Table structure for table `stock_alerts`
--

CREATE TABLE `stock_alerts` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `item_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `alert_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'LOW_STOCK',
  `threshold` int NOT NULL,
  `current_quantity` int NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `acknowledged_at` datetime DEFAULT NULL,
  `acknowledged_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_alerts`
--


--
-- Table structure for table `suppliers`
--

CREATE TABLE `suppliers` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `contact_person` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `tax_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_terms` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `suppliers`
--


--
-- Table structure for table `support_tickets`
--

CREATE TABLE `support_tickets` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ticket_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'GENERAL',
  `priority` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MEDIUM',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'OPEN',
  `assigned_to` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `assigned_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `assigned_at` datetime DEFAULT NULL,
  `resolved_at` datetime DEFAULT NULL,
  `resolution` text COLLATE utf8mb4_unicode_ci,
  `resolution_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `support_tickets_ticket_number_unique` (`ticket_number`),
  KEY `support_tickets_assigned_to_foreign` (`assigned_to`),
  KEY `support_tickets_assigned_by_foreign` (`assigned_by`),
  KEY `support_tickets_resolution_by_foreign` (`resolution_by`),
  KEY `support_tickets_branch_id_foreign` (`branch_id`),
  KEY `tickets_number_idx` (`ticket_number`),
  KEY `tickets_subject_idx` (`subject`),
  KEY `tickets_status_idx` (`status`),
  KEY `tickets_priority_idx` (`priority`),
  KEY `tickets_customer_idx` (`customer_id`),
  CONSTRAINT `support_tickets_assigned_by_foreign` FOREIGN KEY (`assigned_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `support_tickets_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `support_tickets_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `support_tickets_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `support_tickets_resolution_by_foreign` FOREIGN KEY (`resolution_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `support_tickets`
--

INSERT INTO `support_tickets` VALUES ('019c5d5f-0584-71a1-a783-3f2f9787c9e2','TCK-VERIFY-1771093034','019c5d5f-0562-7188-a8d0-5d9f2b26de1e','Verify Logic','Test description','Technical','HIGH','OPEN',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-14 16:17:14','2026-02-14 16:17:14'),('1e92a546-a7e5-4143-926d-c928e952eac6','TKT-DE5A7I','15ef779e-490b-4b3b-b59b-b57ca05407b8','طلب استرجاع','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','MEDIUM','CLOSED',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07'),('4704e3af-d7a5-44e1-b468-9b2a9d77b69c','TKT-8QCQIR','4b93330c-5576-4830-b850-24a1b5bbd05c','طلب استرجاع','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','URGENT','CLOSED',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07'),('5649fc61-7c84-4664-9cf6-ced8c4a166ce','TKT-QIC8NT','019c5d5f-0562-7188-a8d0-5d9f2b26de1e','طلب استرجاع','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','MEDIUM','CLOSED',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07'),('84f17652-da9b-424e-90d4-23bf395fe4e4','TKT-1NFA70','4b93330c-5576-4830-b850-24a1b5bbd05c','استفسار عن الحجز','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','MEDIUM','OPEN',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07'),('8a9796de-b64e-47f1-80ff-c93360b1dd63','TKT-NV2SUW','019c5d5f-0562-7188-a8d0-5d9f2b26de1e','استفسار عن الحجز','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','LOW','OPEN',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07'),('ea5a2c9e-8c4d-4cfb-988d-f7a7ee29265d','TKT-6M58JX','4b93330c-5576-4830-b850-24a1b5bbd05c','طلب استرجاع','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','LOW','RESOLVED',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07'),('edf01ae5-43c9-4f14-95ff-12d3babc4323','TKT-0W1UTB','15ef779e-490b-4b3b-b59b-b57ca05407b8','استفسار عن الحجز','تم إنشاء هذه التذكرة كبيانات تجريبية للنظام.','GENERAL','URGENT','OPEN',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-02-16 16:55:07','2026-02-16 16:55:07');

--
-- Table structure for table `system_notifications`
--

CREATE TABLE `system_notifications` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `channel` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
  `priority` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MEDIUM',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `sent_at` datetime DEFAULT NULL,
  `read_at` datetime DEFAULT NULL,
  `link_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `system_notifications_user_id_status_index` (`user_id`,`status`),
  CONSTRAINT `system_notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `system_notifications`
--


--
-- Table structure for table `task_comments`
--

CREATE TABLE `task_comments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `task_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `author_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `task_comments_task_id_foreign` (`task_id`),
  KEY `task_comments_author_id_foreign` (`author_id`),
  CONSTRAINT `task_comments_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
  CONSTRAINT `task_comments_task_id_foreign` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `task_comments`
--


--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `assigned_to` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `assigned_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `priority` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'MEDIUM',
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `due_date` datetime DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `tags` json DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tasks_assigned_by_foreign` (`assigned_by`),
  KEY `tasks_branch_id_foreign` (`branch_id`),
  KEY `tasks_assigned_to_status_index` (`assigned_to`,`status`),
  CONSTRAINT `tasks_assigned_by_foreign` FOREIGN KEY (`assigned_by`) REFERENCES `users` (`id`),
  CONSTRAINT `tasks_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`),
  CONSTRAINT `tasks_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tasks`
--


--
-- Table structure for table `tax_rates`
--

CREATE TABLE `tax_rates` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'STANDARD',
  `rate` double NOT NULL DEFAULT '0',
  `description` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `effective_from` datetime NOT NULL,
  `effective_to` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tax_rates`
--


--
-- Table structure for table `tax_records`
--

CREATE TABLE `tax_records` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `period` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `due_date` datetime NOT NULL,
  `paid_date` datetime DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `documents` json DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tax_records_branch_id_foreign` (`branch_id`),
  KEY `tax_records_created_by_foreign` (`created_by`),
  KEY `tax_records_type_period_index` (`type`,`period`),
  KEY `tax_records_due_date_index` (`due_date`),
  KEY `tax_records_status_index` (`status`),
  CONSTRAINT `tax_records_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tax_records_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tax_records`
--


--
-- Table structure for table `test_drive_bookings`
--

CREATE TABLE `test_drive_bookings` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` datetime NOT NULL,
  `time_slot` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `payment_status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `test_drive_bookings_customer_id_foreign` (`customer_id`),
  KEY `test_drive_bookings_vehicle_id_foreign` (`vehicle_id`),
  CONSTRAINT `test_drive_bookings_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `test_drive_bookings_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `test_drive_bookings`
--


--
-- Table structure for table `test_drive_submissions`
--

CREATE TABLE `test_drive_submissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_model` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `preferred_date` datetime NOT NULL,
  `preferred_time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `submitted_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `test_drive_submissions`
--


--
-- Table structure for table `ticket_comments`
--

CREATE TABLE `ticket_comments` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ticket_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `author_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_internal` tinyint(1) NOT NULL DEFAULT '0',
  `attachments` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `ticket_comments_ticket_id_foreign` (`ticket_id`),
  KEY `ticket_comments_author_id_foreign` (`author_id`),
  CONSTRAINT `ticket_comments_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
  CONSTRAINT `ticket_comments_ticket_id_foreign` FOREIGN KEY (`ticket_id`) REFERENCES `support_tickets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_comments`
--


--
-- Table structure for table `ticket_timelines`
--

CREATE TABLE `ticket_timelines` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ticket_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `performed_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `metadata` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `ticket_timelines_performed_by_foreign` (`performed_by`),
  KEY `ticket_timelines_ticket_id_created_at_index` (`ticket_id`,`created_at`),
  CONSTRAINT `ticket_timelines_performed_by_foreign` FOREIGN KEY (`performed_by`) REFERENCES `users` (`id`),
  CONSTRAINT `ticket_timelines_ticket_id_foreign` FOREIGN KEY (`ticket_id`) REFERENCES `support_tickets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_timelines`
--


--
-- Table structure for table `time_slots`
--

CREATE TABLE `time_slots` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `day_of_week` int NOT NULL,
  `start_time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `end_time` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `max_bookings` int NOT NULL DEFAULT '1',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `time_slots`
--


--
-- Table structure for table `timeline_events`
--

CREATE TABLE `timeline_events` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `event_date` date NOT NULL,
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `timeline_events`
--

INSERT INTO `timeline_events` VALUES ('019c67fe-9b84-728f-946d-e939c66ff908','تأسيس الشركة','تأسست شركة الحمد لاستيراد السيارات كموزع معتمد لتاتا موتورز في مدن القناة','2010-01-01',NULL,NULL,1,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b87-7022-8fd5-664fb84dbeea','توسع الخدمات','إضافة خدمات الصيانة وقطع الغيار','2015-01-01',NULL,NULL,2,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b8b-72dd-b34d-e630a3a61a23','التحول الرقمي','إطلاق النظام الإلكتروني لإدارة المبيعات والخدمات','2020-01-01',NULL,NULL,3,1,'2026-02-16 17:47:45','2026-02-16 17:47:45'),('019c67fe-9b8e-70c1-a221-5739eb0fc5c8','التطوير المستمر','تحديث النظام وتوسيع قاعدة العملاء','2024-01-01',NULL,NULL,4,1,'2026-02-16 17:47:45','2026-02-16 17:47:45');

--
-- Table structure for table `training_records`
--

CREATE TABLE `training_records` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `employee_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `training_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `cost` double DEFAULT NULL,
  `provider` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `certificate` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PLANNED',
  `feedback` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `training_records_employee_id_index` (`employee_id`),
  CONSTRAINT `training_records_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `training_records`
--


--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reference_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'INCOME',
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `description` text COLLATE utf8mb4_unicode_ci,
  `date` datetime NOT NULL,
  `payment_method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `invoice_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `transactions_reference_id_unique` (`reference_id`),
  KEY `transactions_branch_id_foreign` (`branch_id`),
  KEY `transactions_customer_id_foreign` (`customer_id`),
  KEY `transactions_invoice_id_foreign` (`invoice_id`),
  CONSTRAINT `transactions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `transactions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `transactions_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transactions`
--


--
-- Table structure for table `user_permissions`
--

CREATE TABLE `user_permissions` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `permission_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `granted_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `granted_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `expires_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_permissions_user_id_permission_id_unique` (`user_id`,`permission_id`),
  KEY `user_permissions_permission_id_foreign` (`permission_id`),
  CONSTRAINT `user_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_permissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_permissions`
--


--
-- Table structure for table `vehicle_images`
--

CREATE TABLE `vehicle_images` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `alt_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_primary` tinyint(1) NOT NULL DEFAULT '0',
  `order` int NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `vehicle_images_vehicle_id_foreign` (`vehicle_id`),
  CONSTRAINT `vehicle_images_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vehicle_images`
--

INSERT INTO `vehicle_images` VALUES ('019c6bb9-5260-7179-ad5a-c07d40c3ddb7','019c67f2-f817-719c-86d4-6d6699b71dee','/uploads/vehicles/PRIMA-3328.K-1.jpg','Tata PRIMA 3328.K',1,0,'2026-02-17 13:10:33'),('019c6bb9-526a-7221-8fb7-eee96141260e','019c67f2-f817-719c-86d4-6d6699b71dee','/uploads/vehicles/prima-3328k-1.jpg','Tata PRIMA 3328.K',0,1,'2026-02-17 13:10:33'),('019c6bb9-526d-73de-af0d-2ed83ab0314e','019c67f2-f817-719c-86d4-6d6699b71dee','/uploads/vehicles/prima-3328k-2.jpg','Tata PRIMA 3328.K',0,2,'2026-02-17 13:10:33'),('019c6bb9-5271-7126-9d87-e090e26f6cc3','019c67f2-f820-7017-af74-eb83b4e21ea3','/uploads/vehicles/LP-613-1.jpg','Tata LP 613',1,0,'2026-02-17 13:10:33'),('019c6bb9-5273-7332-9a8d-5be5e5a69fe2','019c67f2-f820-7017-af74-eb83b4e21ea3','/uploads/vehicles/lp-613-2.jpg','Tata LP 613',0,1,'2026-02-17 13:10:33'),('019c6bb9-5277-7116-b145-0b5b50531cb9','019c67f2-f826-73b2-b163-362481e9ab80','/uploads/vehicles/LPT-1618-1.jpg','Tata LPT 1618',1,0,'2026-02-17 13:10:33'),('019c6bb9-527e-718b-a91b-3d21d9b76594','019c67f2-f82c-7097-9e35-5b2c0d4e08b0','/uploads/vehicles/ULTRA-T.7-1.jpg','Tata ULTRA T.7',1,0,'2026-02-17 13:10:33'),('019c6bb9-5282-7112-a2e9-41e96084683a','019c67f2-f835-70ab-9a11-7640d8861a3b','/uploads/vehicles/XENON-SC-1.jpg','Tata XENON SC',1,0,'2026-02-17 13:10:33'),('019c6bb9-5287-714f-8f36-c5556102c259','019c67f2-f83f-7236-ada8-e319f4847efd','/uploads/vehicles/LPT-613-1.jpg','Tata LPT 613',1,0,'2026-02-17 13:10:33'),('019c6bb9-528b-7072-9936-c087a7b040b5','019c67f2-f83f-7236-ada8-e319f4847efd','/uploads/vehicles/lpt613-tipper-1.jpg','Tata LPT 613',0,1,'2026-02-17 13:10:33'),('019c6bb9-5293-7057-af0d-aae63f59a1e3','019c6b95-6d61-73ce-bec8-0bee1aca65cf','/uploads/vehicles/ULTRA-T.9-1.jpg','Tata ULTRA T.9',1,0,'2026-02-17 13:10:33');

--
-- Table structure for table `vehicle_pricing`
--

CREATE TABLE `vehicle_pricing` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `base_price` double NOT NULL,
  `discount_price` double DEFAULT NULL,
  `discount_percentage` double DEFAULT NULL,
  `taxes` double NOT NULL DEFAULT '0',
  `fees` double NOT NULL DEFAULT '0',
  `total_price` double NOT NULL,
  `currency` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EGP',
  `has_discount` tinyint(1) NOT NULL DEFAULT '0',
  `discount_expires` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `vehicle_pricing_vehicle_id_unique` (`vehicle_id`),
  CONSTRAINT `vehicle_pricing_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vehicle_pricing`
--


--
-- Table structure for table `vehicles`
--

CREATE TABLE `vehicles` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `make` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `year` int NOT NULL,
  `price` double NOT NULL,
  `stock_quantity` int NOT NULL DEFAULT '0',
  `stock_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vin` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `fuel_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `transmission` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mileage` int DEFAULT NULL,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'AVAILABLE',
  `featured` tinyint(1) NOT NULL DEFAULT '0',
  `features` json DEFAULT NULL,
  `branch_id` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `vehicles_stock_number_unique` (`stock_number`),
  UNIQUE KEY `vehicles_vin_unique` (`vin`),
  KEY `vehicles_branch_id_foreign` (`branch_id`),
  KEY `vehicles_make_idx` (`make`),
  KEY `vehicles_model_idx` (`model`),
  KEY `vehicles_status_idx` (`status`),
  KEY `vehicles_category_idx` (`category`),
  CONSTRAINT `vehicles_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vehicles`
--

INSERT INTO `vehicles` VALUES ('019c5d5f-056c-720e-9ce9-ec49aa2715e9','Honda','Civic',2024,30000,1,'STK-VERIFY-1771093034','VIN-VERIFY-1771093034',NULL,'Sedan','Hybrid','Automatic',NULL,NULL,'AVAILABLE',0,NULL,NULL,'2026-02-14 16:17:14','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67e7-d404-70d3-aacb-db0d97a64d56','Tata Motors','Tigor',2025,365000,5,'TIGOR-2025-001','BPKN76HPTLH73CHJQ','سيدان مدمجة بأربعة أبواب مع مساحة رحبة في المقصورة.','SEDAN','PETROL','MANUAL',0,'White','AVAILABLE',1,'[\"419 لتر\", \"86 حصان\", \"Harman Audio\"]','019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:22:52','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67ea-cd36-7114-9e3f-0a0d570303fc','Tata Motors','Altroz',2025,395000,5,'ALTROZ-2025-001','KJIDLDGGB0HVOEDDD','هاتشباك بريميوم بتصنيف أمان 5 نجوم.','HATCHBACK','PETROL','MANUAL',0,'White','AVAILABLE',1,'[\"110 حصان\", \"6 وسائد\", \"TPMS\"]','019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:26:07','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67eb-8aa0-707c-b59d-bc0546ca3748','Tata Motors','Punch',2025,415000,5,'PUNCH-2025-001','E3OYUS9CTNSERPQV7','كروس أوفر مدمج بارتفاع عن الأرض 187 مم.','SUV','PETROL','MANUAL',0,'White','AVAILABLE',1,'[\"5 نجوم أمان\", \"187 مم\", \"Traction Pro\"]','019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:26:55','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67ec-fdd6-72af-a8f6-adf4f5a8c450','Tata Motors','Nexon',2025,495000,1,'NEXON-2025-001','TK6RF8VWCG1MEWG5C','Vehicle Description','SEDAN','PETROL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:28:30','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67f0-d91c-7213-9b77-eeda27c8b9d8','Tata Motors','Nexon EV',2025,985000,0,'NEXON-EV-TEST-002',NULL,'Test Description','SUV','ELECTRIC','AUTOMATIC',NULL,NULL,'AVAILABLE',0,NULL,NULL,'2026-02-16 17:32:43','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67f1-2863-70f7-95d2-45c64918fbe8','Tata Motors','Nexon EV',2025,985000,0,'NEXON-EV-TEST-003',NULL,'إصدار كهربائي بالكامل من Nexon بمدى 465 كم.','SUV','ELECTRIC','AUTOMATIC',NULL,NULL,'AVAILABLE',0,NULL,NULL,'2026-02-16 17:33:03','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67f2-f7f6-71c5-81d0-29e434d7abbe','Tata Motors','Nexon EV',2025,985000,1,'NEXON-EV-2025-001','KLIS5DBKNJSDNJQ4U','إصدار كهربائي بالكامل من Nexon بمدى 465 كم.','SEDAN','ELECTRIC','MANUAL',NULL,NULL,'AVAILABLE',0,'[\"465 كم\", \"شحن سريع\", \"فتحة سقف\"]','019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67f2-f803-7230-b9fa-71b663cfef27','Tata Motors','Harrier',2025,995000,1,'HARRIER-2025-001','EJ48MMJGU1F6I4Z8L','Vehicle Description','SEDAN','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67f2-f811-70bc-8a2d-833f60402e8c','Tata Motors','Safari',2025,1050000,1,'SAFARI-2025-001','7COAXYY8TCYUY451Q','Vehicle Description','SEDAN','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-17 10:30:40','2026-02-17 10:30:40'),('019c67f2-f817-719c-86d4-6d6699b71dee','Tata','PRIMA 3328.K',2024,1500000,1,'TAT-001','BPGEUPVBYLZARLKWC','Vehicle Description','TRUCK','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-16 17:35:02',NULL),('019c67f2-f820-7017-af74-eb83b4e21ea3','Tata','LP 613',2024,850000,1,'TAT-002','ASQXIIFN2EPFXWY8X','Vehicle Description','VAN','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-16 17:35:02',NULL),('019c67f2-f826-73b2-b163-362481e9ab80','Tata','LPT 1618',2024,650000,1,'TAT-003','PIBHTJFR97I0GWHOS','Vehicle Description','COMMERCIAL','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-16 17:35:02',NULL),('019c67f2-f82c-7097-9e35-5b2c0d4e08b0','Tata','ULTRA T.7',2024,450000,1,'TAT-004','XBJEGODZLONQOCCAU','Vehicle Description','COMMERCIAL','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-16 17:35:02',NULL),('019c67f2-f835-70ab-9a11-7640d8861a3b','Tata','XENON SC',2024,380000,1,'TAT-005','GQHZNGUQ4WMCNMP2Z','Vehicle Description','TRUCK','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-16 17:35:02',NULL),('019c67f2-f83f-7236-ada8-e319f4847efd','Tata','LPT 613',2024,420000,1,'TAT-006','APAN7GKQOMQJCR42E','Vehicle Description','COMMERCIAL','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',0,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-16 17:35:02','2026-02-16 17:35:02',NULL),('019c6b95-6d61-73ce-bec8-0bee1aca65cf','Tata','ULTRA T.9',2024,520000,1,'TAT-007','HFLIL67B9THAWD0WQ','تاتا ULTRA T.9 - نصف نقل بقدرة تحمل عالية وأداء متميز','COMMERCIAL','DIESEL','MANUAL',NULL,NULL,'AVAILABLE',1,NULL,'019c67e7-cd93-7313-83d5-563ebca52f79','2026-02-17 10:31:20','2026-02-17 10:31:20',NULL),('c92d4ab6-d33f-4969-87e0-ef253ffaab40','Tata Motors','Tata Tiago',2025,345000,5,'TIAGO-2025-001',NULL,'هاتشباك عصرية بخمسة أبواب مصممة للمدن المصرية.','HATCHBACK','PETROL','MANUAL',NULL,NULL,'AVAILABLE',0,'[\"86 حصان\", \"5.5 لتر/100كم\", \"وسائد هوائية مزدوجة\"]','019c67d1-c3d3-705d-adf1-e171f8638204','2026-02-16 17:05:03','2026-02-17 10:30:40','2026-02-17 10:30:40');

--
-- Table structure for table `warranties`
--

CREATE TABLE `warranties` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `warranty_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `contract_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `coverage` json DEFAULT NULL,
  `terms` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ACTIVE',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `warranties_warranty_number_unique` (`warranty_number`),
  KEY `warranties_contract_id_foreign` (`contract_id`),
  KEY `warranties_vehicle_id_index` (`vehicle_id`),
  CONSTRAINT `warranties_contract_id_foreign` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`),
  CONSTRAINT `warranties_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `warranties`
--


--
-- Table structure for table `warranty_claims`
--

CREATE TABLE `warranty_claims` (
  `id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `claim_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `warranty_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `vehicle_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `customer_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `claim_date` datetime NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
  `estimated_cost` double DEFAULT NULL,
  `actual_cost` double DEFAULT NULL,
  `approved_by` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `resolved_at` datetime DEFAULT NULL,
  `resolution` text COLLATE utf8mb4_unicode_ci,
  `attachments` json DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `warranty_claims_claim_number_unique` (`claim_number`),
  KEY `warranty_claims_warranty_id_foreign` (`warranty_id`),
  KEY `warranty_claims_vehicle_id_foreign` (`vehicle_id`),
  KEY `warranty_claims_customer_id_foreign` (`customer_id`),
  KEY `warranty_claims_created_by_foreign` (`created_by`),
  KEY `warranty_claims_status_index` (`status`),
  CONSTRAINT `warranty_claims_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `warranty_claims_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `warranty_claims_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`),
  CONSTRAINT `warranty_claims_warranty_id_foreign` FOREIGN KEY (`warranty_id`) REFERENCES `warranties` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `warranty_claims`
--



