/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `action_leave_event_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `action_leave_event_user` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `event_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `action_leave_event_user_unique` (`event_id`,`user_id`),
  KEY `action_leave_event_user_idx` (`user_id`,`event_id`),
  CONSTRAINT `action_leave_event_user_event_id_foreign` FOREIGN KEY (`event_id`) REFERENCES `action_leave_events` (`id`) ON DELETE CASCADE,
  CONSTRAINT `action_leave_event_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `action_leave_events`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `action_leave_events` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `event_type` enum('leave','holiday') COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `target_type` enum('all','company','management','department','employee','employees') COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `created_by` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `action_leave_events_company_id_foreign` (`company_id`),
  KEY `action_leave_events_management_id_foreign` (`management_id`),
  KEY `action_leave_events_department_id_foreign` (`department_id`),
  KEY `action_leave_events_created_by_foreign` (`created_by`),
  KEY `action_leave_events_event_type_start_date_index` (`event_type`,`start_date`),
  KEY `action_leave_events_target_type_start_date_index` (`target_type`,`start_date`),
  CONSTRAINT `action_leave_events_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `action_leave_events_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `action_leave_events_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `action_leave_events_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `allowances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `allowances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` 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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `areas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `areas` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `governorate_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` 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`),
  KEY `areas_governorate_id_index` (`governorate_id`),
  KEY `areas_governorate_active_index` (`governorate_id`,`is_active`),
  KEY `areas_name_index` (`name`),
  CONSTRAINT `areas_governorate_id_foreign` FOREIGN KEY (`governorate_id`) REFERENCES `governorates` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `attendance_import_files`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `attendance_import_files` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `fingerprint_device_id` bigint unsigned NOT NULL,
  `uploaded_by` bigint unsigned DEFAULT NULL,
  `original_file_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stored_file_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mime_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_size` bigint unsigned DEFAULT NULL,
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'completed',
  `total_rows` int unsigned NOT NULL DEFAULT '0',
  `inserted_rows` int unsigned NOT NULL DEFAULT '0',
  `skipped_rows` int unsigned NOT NULL DEFAULT '0',
  `failed_rows` int unsigned NOT NULL DEFAULT '0',
  `error_message` text COLLATE utf8mb4_unicode_ci,
  `meta` json DEFAULT NULL,
  `imported_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `attendance_import_files_uploaded_by_foreign` (`uploaded_by`),
  KEY `attendance_import_files_fingerprint_device_id_imported_at_index` (`fingerprint_device_id`,`imported_at`),
  KEY `attendance_import_files_status_index` (`status`),
  CONSTRAINT `attendance_import_files_fingerprint_device_id_foreign` FOREIGN KEY (`fingerprint_device_id`) REFERENCES `fingerprint_devices` (`id`) ON DELETE CASCADE,
  CONSTRAINT `attendance_import_files_uploaded_by_foreign` FOREIGN KEY (`uploaded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `attendance_logs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `attendance_logs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `fingerprint_device_id` bigint unsigned NOT NULL,
  `device_uid` smallint unsigned NOT NULL,
  `employee_device_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state` tinyint DEFAULT NULL,
  `type` tinyint DEFAULT NULL,
  `source` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'device',
  `punched_at` datetime NOT NULL,
  `synced_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `attendance_logs_device_uid_punched_unique` (`fingerprint_device_id`,`device_uid`,`punched_at`),
  KEY `attendance_logs_fingerprint_device_id_punched_at_index` (`fingerprint_device_id`,`punched_at`),
  KEY `attendance_logs_source_index` (`source`),
  KEY `attendance_logs_employee_device_id_index` (`employee_device_id`),
  CONSTRAINT `attendance_logs_fingerprint_device_id_foreign` FOREIGN KEY (`fingerprint_device_id`) REFERENCES `fingerprint_devices` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `banks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `banks` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contract_date` date DEFAULT NULL,
  `contact_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `default_currency_id` bigint unsigned DEFAULT NULL,
  `country_id` bigint unsigned 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`),
  KEY `banks_default_currency_id_foreign` (`default_currency_id`),
  KEY `banks_country_id_foreign` (`country_id`),
  CONSTRAINT `banks_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE SET NULL,
  CONSTRAINT `banks_default_currency_id_foreign` FOREIGN KEY (`default_currency_id`) REFERENCES `currencies` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `branches`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `branches` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name_ar` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `latitude` decimal(10,7) DEFAULT NULL,
  `longitude` decimal(10,7) DEFAULT NULL,
  `login_radius_meters` int unsigned NOT NULL DEFAULT '100',
  `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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `break_sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `break_sessions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `note` text COLLATE utf8mb4_unicode_ci,
  `started_at` timestamp NOT NULL,
  `ended_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `break_sessions_user_id_started_at_index` (`user_id`,`started_at`),
  KEY `break_sessions_user_id_ended_at_index` (`user_id`,`ended_at`),
  KEY `break_sessions_ended_at_index` (`ended_at`),
  CONSTRAINT `break_sessions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `cache`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache` (
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` bigint NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `cache_locks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache_locks` (
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `owner` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` bigint NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_locks_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `chat_conversation_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chat_conversation_user` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `conversation_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `last_read_message_id` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `chat_conv_user_unique` (`conversation_id`,`user_id`),
  KEY `chat_conversation_user_last_read_message_id_foreign` (`last_read_message_id`),
  KEY `chat_conv_user_lookup_idx` (`user_id`,`conversation_id`),
  CONSTRAINT `chat_conversation_user_conversation_id_foreign` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `chat_conversation_user_last_read_message_id_foreign` FOREIGN KEY (`last_read_message_id`) REFERENCES `chat_messages` (`id`) ON DELETE SET NULL,
  CONSTRAINT `chat_conversation_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `chat_conversations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chat_conversations` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `type` enum('direct','team','company','management','department') COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `participant_one_id` bigint unsigned DEFAULT NULL,
  `participant_two_id` bigint unsigned DEFAULT NULL,
  `created_by` bigint unsigned DEFAULT NULL,
  `last_message_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `chat_conv_type_team_unique` (`type`),
  UNIQUE KEY `chat_conv_type_direct_pair_unique` (`type`,`participant_one_id`,`participant_two_id`),
  UNIQUE KEY `chat_conv_type_company_uniq` (`type`,`company_id`),
  UNIQUE KEY `chat_conv_type_management_uniq` (`type`,`management_id`),
  UNIQUE KEY `chat_conv_type_department_uniq` (`type`,`department_id`),
  KEY `chat_conversations_participant_one_id_foreign` (`participant_one_id`),
  KEY `chat_conversations_participant_two_id_foreign` (`participant_two_id`),
  KEY `chat_conversations_created_by_foreign` (`created_by`),
  KEY `chat_conv_type_last_msg_idx` (`type`,`last_message_at`),
  KEY `chat_conversations_company_id_foreign` (`company_id`),
  KEY `chat_conversations_management_id_foreign` (`management_id`),
  KEY `chat_conversations_department_id_foreign` (`department_id`),
  KEY `chat_conv_scope_lookup_idx` (`type`,`company_id`,`management_id`,`department_id`),
  CONSTRAINT `chat_conversations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `chat_conversations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `chat_conversations_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `chat_conversations_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE SET NULL,
  CONSTRAINT `chat_conversations_participant_one_id_foreign` FOREIGN KEY (`participant_one_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `chat_conversations_participant_two_id_foreign` FOREIGN KEY (`participant_two_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `chat_messages`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chat_messages` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `conversation_id` bigint unsigned NOT NULL,
  `sender_id` bigint unsigned NOT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `chat_messages_sender_id_foreign` (`sender_id`),
  KEY `chat_msgs_conv_created_idx` (`conversation_id`,`created_at`),
  CONSTRAINT `chat_messages_conversation_id_foreign` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `chat_messages_sender_id_foreign` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `companies`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `companies` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `responsible_user_id` bigint unsigned DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `companies_code_unique` (`code`),
  KEY `companies_responsible_user_id_foreign` (`responsible_user_id`),
  CONSTRAINT `companies_responsible_user_id_foreign` FOREIGN KEY (`responsible_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `contract_allowances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `contract_allowances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `contract_id` bigint unsigned NOT NULL,
  `allowance_id` bigint unsigned NOT NULL,
  `value_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'amount',
  `value` decimal(12,2) NOT NULL DEFAULT '0.00',
  `calculated_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contract_allowances_contract_id_index` (`contract_id`),
  KEY `contract_allowances_allowance_id_index` (`allowance_id`),
  CONSTRAINT `contract_allowances_allowance_id_foreign` FOREIGN KEY (`allowance_id`) REFERENCES `allowances` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `contract_allowances_contract_id_foreign` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `contract_deductions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `contract_deductions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `contract_id` bigint unsigned NOT NULL,
  `deduction_id` bigint unsigned NOT NULL,
  `value_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'amount',
  `value` decimal(12,2) NOT NULL DEFAULT '0.00',
  `calculated_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contract_deductions_contract_id_index` (`contract_id`),
  KEY `contract_deductions_deduction_id_index` (`deduction_id`),
  CONSTRAINT `contract_deductions_contract_id_foreign` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `contract_deductions_deduction_id_foreign` FOREIGN KEY (`deduction_id`) REFERENCES `deductions` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `contracts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `contracts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `basic_salary` decimal(12,2) NOT NULL,
  `allowance_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'amount',
  `allowance_value` decimal(12,2) NOT NULL DEFAULT '0.00',
  `deduction_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'amount',
  `deduction_value` decimal(12,2) NOT NULL DEFAULT '0.00',
  `total_salary` decimal(12,2) NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `terminated_at` timestamp NULL DEFAULT NULL,
  `termination_reason` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `contracts_user_id_status_index` (`user_id`,`status`),
  KEY `contracts_start_date_end_date_index` (`start_date`,`end_date`),
  CONSTRAINT `contracts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `countries`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `countries` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code` varchar(10) 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`),
  UNIQUE KEY `countries_code_unique` (`code`),
  KEY `countries_is_active_index` (`is_active`),
  KEY `countries_name_index` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `currencies`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `currencies` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL,
  `symbol` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `currencies_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `deductions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deductions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` 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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `department_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `department_user` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `department_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `department_user_department_id_user_id_unique` (`department_id`,`user_id`),
  KEY `department_user_user_id_foreign` (`user_id`),
  CONSTRAINT `department_user_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE,
  CONSTRAINT `department_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `departments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `departments` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `management_id` bigint unsigned NOT NULL,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `responsible_user_id` bigint unsigned DEFAULT NULL,
  `second_approver_scope` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'management',
  `second_approver_user_id` bigint unsigned DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `departments_code_unique` (`code`),
  KEY `departments_management_id_foreign` (`management_id`),
  KEY `departments_responsible_user_id_foreign` (`responsible_user_id`),
  KEY `departments_second_approver_scope_index` (`second_approver_scope`),
  KEY `departments_second_approver_user_id_index` (`second_approver_user_id`),
  CONSTRAINT `departments_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE CASCADE,
  CONSTRAINT `departments_responsible_user_id_foreign` FOREIGN KEY (`responsible_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `departments_second_approver_user_id_foreign` FOREIGN KEY (`second_approver_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `employee_monthly_allowances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `employee_monthly_allowances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `allowance_id` bigint unsigned NOT NULL,
  `month` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `emp_m_allow_uniq` (`user_id`,`allowance_id`,`month`),
  KEY `employee_monthly_allowances_allowance_id_foreign` (`allowance_id`),
  KEY `emp_m_allow_month_user_idx` (`month`,`user_id`),
  CONSTRAINT `employee_monthly_allowances_allowance_id_foreign` FOREIGN KEY (`allowance_id`) REFERENCES `allowances` (`id`) ON DELETE CASCADE,
  CONSTRAINT `employee_monthly_allowances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `employee_monthly_deductions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `employee_monthly_deductions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `deduction_id` bigint unsigned NOT NULL,
  `month` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `emp_m_ded_uniq` (`user_id`,`deduction_id`,`month`),
  KEY `employee_monthly_deductions_deduction_id_foreign` (`deduction_id`),
  KEY `emp_m_ded_month_user_idx` (`month`,`user_id`),
  CONSTRAINT `employee_monthly_deductions_deduction_id_foreign` FOREIGN KEY (`deduction_id`) REFERENCES `deductions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `employee_monthly_deductions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `fingerprint_devices`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `fingerprint_devices` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `serial_number` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `port` int unsigned NOT NULL DEFAULT '4370',
  `location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `last_synced_at` datetime 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 `fingerprint_devices_code_unique` (`code`),
  UNIQUE KEY `fingerprint_devices_serial_number_unique` (`serial_number`),
  KEY `fingerprint_devices_is_active_name_index` (`is_active`,`name`),
  KEY `fingerprint_devices_ip_address_index` (`ip_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `governorates`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `governorates` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `country_id` bigint unsigned NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` 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`),
  KEY `governorates_country_id_index` (`country_id`),
  KEY `governorates_country_active_index` (`country_id`,`is_active`),
  KEY `governorates_name_index` (`name`),
  CONSTRAINT `governorates_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `holiday_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `holiday_user` (
  `holiday_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  UNIQUE KEY `holiday_user_holiday_id_user_id_unique` (`holiday_id`,`user_id`),
  KEY `holiday_user_user_id_foreign` (`user_id`),
  CONSTRAINT `holiday_user_holiday_id_foreign` FOREIGN KEY (`holiday_id`) REFERENCES `holidays` (`id`) ON DELETE CASCADE,
  CONSTRAINT `holiday_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `holidays`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `holidays` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `holiday_date` date NOT NULL,
  `occasion_type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'public_holiday',
  `target_scope` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'all',
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `holidays_company_id_foreign` (`company_id`),
  KEY `holidays_management_id_foreign` (`management_id`),
  KEY `holidays_department_id_foreign` (`department_id`),
  KEY `holidays_holiday_date_occasion_type_index` (`holiday_date`,`occasion_type`),
  KEY `holidays_target_scope_index` (`target_scope`),
  CONSTRAINT `holidays_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `holidays_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `holidays_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `hr_profiles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `hr_profiles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `working_days` json DEFAULT NULL,
  `vacation_total_days` int unsigned NOT NULL DEFAULT '0',
  `vacation_accrual_after_days` int unsigned NOT NULL DEFAULT '0',
  `leave_type_days` json DEFAULT NULL,
  `vacation_balance` int unsigned NOT NULL DEFAULT '0' COMMENT 'رصيد الاجازات (بالأيام)',
  `vacation_accrual_months` int unsigned NOT NULL DEFAULT '0' COMMENT 'استحقاق رصيد الإجازة بعد التعيين (بالشهور)',
  `has_check_in_fingerprint` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'له بصمة حضور',
  `has_check_out_fingerprint` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'له بصمة انصراف',
  `monthly_permissions_count` int unsigned NOT NULL DEFAULT '0' COMMENT 'عدد الأذون الشهرية',
  `permission_duration` int unsigned NOT NULL DEFAULT '0' COMMENT 'مدة الإذن الواحد (بالدقائق)',
  `flexible_attendance` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'حضور مرن: يعد 8 ساعات من وقت الحضور',
  `attendance_time` time DEFAULT NULL COMMENT 'ميعاد الحضور',
  `calculate_overtime` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'يحسب له إضافي',
  `overtime_after_minutes` int unsigned NOT NULL DEFAULT '0' COMMENT 'يحسب له إضافي بعد كام دقيقة',
  `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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `job_batches`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `leave_requests`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `leave_requests` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `leave_type_id` bigint unsigned DEFAULT NULL,
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `leave_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `from_date` date NOT NULL,
  `to_date` date NOT NULL,
  `days_count` decimal(5,2) NOT NULL,
  `reason` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending_l1',
  `current_level` tinyint unsigned NOT NULL DEFAULT '1',
  `level1_approver_id` bigint unsigned DEFAULT NULL,
  `level1_status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `level1_comment` text COLLATE utf8mb4_unicode_ci,
  `level1_acted_at` timestamp NULL DEFAULT NULL,
  `level2_scope` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `level2_approver_id` bigint unsigned DEFAULT NULL,
  `level2_status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `level2_comment` text COLLATE utf8mb4_unicode_ci,
  `level2_acted_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text COLLATE utf8mb4_unicode_ci,
  `rejected_by_level` tinyint unsigned DEFAULT NULL,
  `submitted_at` timestamp NULL DEFAULT NULL,
  `finalized_at` timestamp NULL DEFAULT NULL,
  `canceled_at` timestamp NULL DEFAULT NULL,
  `cancel_reason` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `leave_requests_company_id_foreign` (`company_id`),
  KEY `leave_requests_management_id_foreign` (`management_id`),
  KEY `leave_requests_department_id_foreign` (`department_id`),
  KEY `leave_requests_user_id_status_index` (`user_id`,`status`),
  KEY `leave_requests_level1_approver_id_level1_status_index` (`level1_approver_id`,`level1_status`),
  KEY `leave_requests_level2_approver_id_level2_status_index` (`level2_approver_id`,`level2_status`),
  KEY `leave_requests_submitted_at_index` (`submitted_at`),
  KEY `leave_requests_leave_type_id_index` (`leave_type_id`),
  CONSTRAINT `leave_requests_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leave_requests_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leave_requests_leave_type_id_foreign` FOREIGN KEY (`leave_type_id`) REFERENCES `leave_types` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `leave_requests_level1_approver_id_foreign` FOREIGN KEY (`level1_approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leave_requests_level2_approver_id_foreign` FOREIGN KEY (`level2_approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `leave_requests_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `leave_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `leave_types` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(150) 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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `managements`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `managements` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `company_id` bigint unsigned NOT NULL,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `responsible_user_id` bigint unsigned DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `managements_code_unique` (`code`),
  KEY `managements_company_id_foreign` (`company_id`),
  KEY `managements_responsible_user_id_foreign` (`responsible_user_id`),
  CONSTRAINT `managements_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  CONSTRAINT `managements_responsible_user_id_foreign` FOREIGN KEY (`responsible_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
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 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `mission_requests`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mission_requests` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `destination` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mission_type_id` bigint unsigned DEFAULT NULL,
  `mission_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `visit_cost` decimal(12,2) DEFAULT NULL,
  `from_date` date NOT NULL,
  `to_date` date NOT NULL,
  `purpose` text COLLATE utf8mb4_unicode_ci,
  `default_cost` decimal(12,2) NOT NULL DEFAULT '0.00',
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending_l1',
  `current_level` tinyint unsigned NOT NULL DEFAULT '1',
  `level1_approver_id` bigint unsigned DEFAULT NULL,
  `level1_status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `level1_comment` text COLLATE utf8mb4_unicode_ci,
  `level1_acted_at` timestamp NULL DEFAULT NULL,
  `level2_scope` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `level2_approver_id` bigint unsigned DEFAULT NULL,
  `level2_status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `level2_comment` text COLLATE utf8mb4_unicode_ci,
  `level2_acted_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text COLLATE utf8mb4_unicode_ci,
  `rejected_by_level` tinyint unsigned DEFAULT NULL,
  `submitted_at` timestamp NULL DEFAULT NULL,
  `finalized_at` timestamp NULL DEFAULT NULL,
  `canceled_at` timestamp NULL DEFAULT NULL,
  `cancel_reason` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `mission_requests_company_id_foreign` (`company_id`),
  KEY `mission_requests_management_id_foreign` (`management_id`),
  KEY `mission_requests_department_id_foreign` (`department_id`),
  KEY `mission_requests_user_id_status_index` (`user_id`,`status`),
  KEY `mission_requests_level1_approver_id_level1_status_index` (`level1_approver_id`,`level1_status`),
  KEY `mission_requests_level2_approver_id_level2_status_index` (`level2_approver_id`,`level2_status`),
  KEY `mission_requests_submitted_at_index` (`submitted_at`),
  KEY `mission_requests_mission_type_id_index` (`mission_type_id`),
  CONSTRAINT `mission_requests_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mission_requests_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mission_requests_level1_approver_id_foreign` FOREIGN KEY (`level1_approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mission_requests_level2_approver_id_foreign` FOREIGN KEY (`level2_approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mission_requests_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mission_requests_mission_type_id_foreign` FOREIGN KEY (`mission_type_id`) REFERENCES `mission_types` (`id`) ON DELETE SET NULL,
  CONSTRAINT `mission_requests_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `mission_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mission_types` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sort_order` smallint unsigned 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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `model_has_permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_has_permissions` (
  `permission_id` bigint unsigned NOT NULL,
  `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `model_has_roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_has_roles` (
  `role_id` bigint unsigned NOT NULL,
  `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `monthly_allowances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `monthly_allowances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `allowance_id` bigint unsigned NOT NULL,
  `month` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `monthly_allowances_unique_item` (`user_id`,`allowance_id`,`month`),
  KEY `monthly_allowances_allowance_id_foreign` (`allowance_id`),
  KEY `monthly_allowances_created_by_foreign` (`created_by`),
  KEY `monthly_allowances_month_user_id_index` (`month`,`user_id`),
  CONSTRAINT `monthly_allowances_allowance_id_foreign` FOREIGN KEY (`allowance_id`) REFERENCES `allowances` (`id`) ON DELETE CASCADE,
  CONSTRAINT `monthly_allowances_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `monthly_allowances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `monthly_deductions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `monthly_deductions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `deduction_id` bigint unsigned NOT NULL,
  `month` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_by` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `monthly_deductions_unique_item` (`user_id`,`deduction_id`,`month`),
  KEY `monthly_deductions_deduction_id_foreign` (`deduction_id`),
  KEY `monthly_deductions_created_by_foreign` (`created_by`),
  KEY `monthly_deductions_month_user_id_index` (`month`,`user_id`),
  CONSTRAINT `monthly_deductions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `monthly_deductions_deduction_id_foreign` FOREIGN KEY (`deduction_id`) REFERENCES `deductions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `monthly_deductions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `navigation_menu_orders`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `navigation_menu_orders` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `item_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sort_order` int unsigned NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `navigation_menu_orders_parent_item_unique` (`parent_id`,`item_id`),
  KEY `navigation_menu_orders_parent_sort_index` (`parent_id`,`sort_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `password_reset_otps`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `password_reset_otps` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `otp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expires_at` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `password_reset_otps_email_index` (`email`),
  KEY `otps_expires_at_index` (`expires_at`),
  KEY `otps_email_expires_index` (`email`,`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `password_reset_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `payment_imports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `payment_imports` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `bank_id` bigint unsigned DEFAULT NULL,
  `movement_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `source_file_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_disk` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'local',
  `file_size` bigint unsigned DEFAULT NULL,
  `status` enum('queued','processing','completed','failed') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'queued',
  `total_rows` int unsigned NOT NULL DEFAULT '0',
  `processed_rows` int unsigned NOT NULL DEFAULT '0',
  `created_count` int unsigned NOT NULL DEFAULT '0',
  `failed_count` int unsigned NOT NULL DEFAULT '0',
  `skipped_count` int unsigned NOT NULL DEFAULT '0',
  `error_message` longtext COLLATE utf8mb4_unicode_ci,
  `uploaded_by` bigint unsigned DEFAULT NULL,
  `queued_at` timestamp NULL DEFAULT NULL,
  `started_at` timestamp NULL DEFAULT NULL,
  `finished_at` timestamp NULL DEFAULT NULL,
  `failed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `payment_imports_uploaded_by_foreign` (`uploaded_by`),
  KEY `payment_imports_status_created_at_index` (`status`,`created_at`),
  KEY `payment_imports_bank_product_idx` (`bank_id`),
  CONSTRAINT `payment_imports_bank_id_foreign` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`) ON DELETE SET NULL,
  CONSTRAINT `payment_imports_uploaded_by_foreign` FOREIGN KEY (`uploaded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `permission_requests`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `permission_requests` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `permission_type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `request_date` date NOT NULL,
  `reason` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending_l1',
  `current_level` tinyint unsigned NOT NULL DEFAULT '1',
  `level1_approver_id` bigint unsigned DEFAULT NULL,
  `level1_status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `level1_comment` text COLLATE utf8mb4_unicode_ci,
  `level1_acted_at` timestamp NULL DEFAULT NULL,
  `level2_scope` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `level2_approver_id` bigint unsigned DEFAULT NULL,
  `level2_status` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `level2_comment` text COLLATE utf8mb4_unicode_ci,
  `level2_acted_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text COLLATE utf8mb4_unicode_ci,
  `rejected_by_level` tinyint unsigned DEFAULT NULL,
  `submitted_at` timestamp NULL DEFAULT NULL,
  `finalized_at` timestamp NULL DEFAULT NULL,
  `canceled_at` timestamp NULL DEFAULT NULL,
  `cancel_reason` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `permission_requests_company_id_foreign` (`company_id`),
  KEY `permission_requests_management_id_foreign` (`management_id`),
  KEY `permission_requests_department_id_foreign` (`department_id`),
  KEY `permission_requests_user_id_status_index` (`user_id`,`status`),
  KEY `permission_requests_level1_approver_id_level1_status_index` (`level1_approver_id`,`level1_status`),
  KEY `permission_requests_level2_approver_id_level2_status_index` (`level2_approver_id`,`level2_status`),
  KEY `permission_requests_request_date_index` (`request_date`),
  KEY `permission_requests_submitted_at_index` (`submitted_at`),
  CONSTRAINT `permission_requests_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `permission_requests_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `permission_requests_level1_approver_id_foreign` FOREIGN KEY (`level1_approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `permission_requests_level2_approver_id_foreign` FOREIGN KEY (`level2_approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `permission_requests_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE SET NULL,
  CONSTRAINT `permission_requests_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `permissions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` 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 `permissions_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `personal_access_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `personal_access_tokens` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tokenable_id` bigint unsigned NOT NULL,
  `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `abilities` text COLLATE utf8mb4_unicode_ci,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`),
  KEY `personal_access_tokens_expires_at_index` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `role_has_permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role_has_permissions` (
  `permission_id` bigint unsigned NOT NULL,
  `role_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `role_has_permissions_role_id_foreign` (`role_id`),
  CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `roles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `label` json DEFAULT NULL,
  `level` tinyint unsigned NOT NULL DEFAULT '1',
  `guard_name` 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 `roles_name_guard_name_unique` (`name`,`guard_name`),
  KEY `roles_level_index` (`level`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `salary_advance_installments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `salary_advance_installments` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `salary_advance_id` bigint unsigned NOT NULL,
  `installment_no` int unsigned NOT NULL,
  `due_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `status` enum('pending','partial','paid') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `paid_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sal_adv_inst_adv_no_uniq` (`salary_advance_id`,`installment_no`),
  KEY `sal_adv_inst_adv_status_idx` (`salary_advance_id`,`status`),
  CONSTRAINT `salary_advance_installments_salary_advance_id_foreign` FOREIGN KEY (`salary_advance_id`) REFERENCES `salary_advances` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `salary_advances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `salary_advances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `installment_count` int unsigned NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `remaining_amount` decimal(12,2) NOT NULL DEFAULT '0.00',
  `status` enum('pending','confirmed','rejected') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `first_due_date` date NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `rejected_reason` text COLLATE utf8mb4_unicode_ci,
  `settled_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `salary_advances_user_id_foreign` (`user_id`),
  KEY `salary_advances_status_created_at_index` (`status`,`created_at`),
  CONSTRAINT `salary_advances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint unsigned 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;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `settings` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('text','image','boolean','textarea','date') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'text',
  `title` json NOT NULL,
  `value` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `settings_key_unique` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `status_codes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `status_codes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_en` 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 `status_codes_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `user_flags`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_flags` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `key` 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 `user_flags_key_unique` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `user_user_flags`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_user_flags` (
  `user_id` bigint unsigned NOT NULL,
  `user_flag_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`user_id`,`user_flag_id`),
  KEY `user_user_flags_user_flag_id_foreign` (`user_flag_id`),
  CONSTRAINT `user_user_flags_user_flag_id_foreign` FOREIGN KEY (`user_flag_id`) REFERENCES `user_flags` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_user_flags_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `user_vacation_balances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_vacation_balances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned NOT NULL,
  `hr_profile_id` bigint unsigned DEFAULT NULL,
  `year` smallint unsigned NOT NULL COMMENT 'السنة التي تم فيها الترصيد',
  `granted_days` int unsigned NOT NULL DEFAULT '0' COMMENT 'عدد الأيام التي تم ترصيدها',
  `used_days` int unsigned NOT NULL DEFAULT '0' COMMENT 'عدد الأيام المستخدمة من هذا الرصيد',
  `remaining_days` int unsigned NOT NULL DEFAULT '0' COMMENT 'المتبقي من هذا الرصيد',
  `grant_type` enum('eligibility','annual_reset') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'سبب الترصيد',
  `eligibility_date` date DEFAULT NULL COMMENT 'تاريخ الاستحقاق الفعلي',
  `granted_at` date NOT NULL COMMENT 'تاريخ تنفيذ الترصيد',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_vacation_balances_user_year_unique` (`user_id`,`year`),
  KEY `user_vacation_balances_hr_profile_id_foreign` (`hr_profile_id`),
  KEY `user_vacation_balances_year_grant_type_index` (`year`,`grant_type`),
  CONSTRAINT `user_vacation_balances_hr_profile_id_foreign` FOREIGN KEY (`hr_profile_id`) REFERENCES `hr_profiles` (`id`) ON DELETE SET NULL,
  CONSTRAINT `user_vacation_balances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `emp_code` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `fingerprint_code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'كود البصمة',
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `salary` decimal(12,2) NOT NULL DEFAULT '30.00',
  `birth_date` date DEFAULT NULL,
  `hire_date` date DEFAULT NULL COMMENT 'تاريخ التعيين',
  `gender` enum('male','female') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country_id` bigint unsigned DEFAULT NULL,
  `governorate_id` bigint unsigned DEFAULT NULL,
  `area_id` bigint unsigned DEFAULT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `hr_profile_id` bigint unsigned DEFAULT NULL,
  `company_id` bigint unsigned DEFAULT NULL,
  `management_id` bigint unsigned DEFAULT NULL,
  `department_id` bigint unsigned DEFAULT NULL,
  `branch_id` bigint unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`),
  UNIQUE KEY `users_emp_code_unique` (`emp_code`),
  UNIQUE KEY `users_fingerprint_code_unique` (`fingerprint_code`),
  KEY `users_phone_index` (`phone`),
  KEY `users_country_id_index` (`country_id`),
  KEY `users_governorate_id_index` (`governorate_id`),
  KEY `users_area_id_index` (`area_id`),
  KEY `users_location_composite_index` (`country_id`,`governorate_id`,`area_id`),
  KEY `users_created_at_index` (`created_at`),
  KEY `users_hr_profile_id_foreign` (`hr_profile_id`),
  KEY `users_company_id_foreign` (`company_id`),
  KEY `users_management_id_foreign` (`management_id`),
  KEY `users_department_id_foreign` (`department_id`),
  KEY `users_branch_id_foreign` (`branch_id`),
  CONSTRAINT `users_area_id_foreign` FOREIGN KEY (`area_id`) REFERENCES `areas` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_governorate_id_foreign` FOREIGN KEY (`governorate_id`) REFERENCES `governorates` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_hr_profile_id_foreign` FOREIGN KEY (`hr_profile_id`) REFERENCES `hr_profiles` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_management_id_foreign` FOREIGN KEY (`management_id`) REFERENCES `managements` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1,'0001_01_01_000000_create_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (2,'0001_01_01_000001_create_cache_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (3,'0001_01_01_000002_create_jobs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (4,'2026_04_08_215424_create_personal_access_tokens_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (5,'2026_04_08_220705_create_permission_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (6,'2026_04_08_220707_create_countries_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (7,'2026_04_08_220707_create_governorates_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (8,'2026_04_08_220707_z_create_areas_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (9,'2026_04_08_220708_add_profile_fields_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (10,'2026_04_08_221500_create_password_reset_otps_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (11,'2026_04_08_223422_add_label_to_roles_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12,'2026_04_08_223936_add_performance_indexes',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13,'2026_04_09_000001_create_banks_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (14,'2026_04_09_000002_create_main_products_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15,'2026_04_09_000003_add_product_type_to_main_products_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (16,'2026_04_09_100000_create_teams_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (17,'2026_04_09_100001_add_soft_deletes_to_all_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (18,'2026_04_09_132259_add_birth_date_and_gender_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (19,'2026_04_09_141414_create_settings_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (20,'2026_04_09_141816_add_type_to_settings_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (21,'2026_04_09_200000_add_extra_fields_to_banks_and_main_products',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (22,'2026_04_09_300000_create_accounts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (23,'2026_04_09_300001_create_account_fields_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (24,'2026_04_09_300002_create_account_field_values_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (25,'2026_04_10_000001_create_currencies_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (26,'2026_04_10_000002_add_default_currency_id_to_banks_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (27,'2026_04_10_120000_convert_account_fields_to_multiple_relations',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (28,'2026_04_10_130000_add_name_en_to_account_fields_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (29,'2026_04_10_220000_add_country_id_to_banks_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (30,'2026_04_12_000001_scope_accounts_unique_by_bank_and_product',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (31,'2026_04_12_000002_add_installment_value_to_accounts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (32,'2026_04_12_000003_convert_accounts_os_to_decimal',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (33,'2026_04_12_000004_add_user_flags_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (34,'2026_04_12_000005_create_team_user_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (35,'2026_04_12_000006_add_deleted_at_to_team_user_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (36,'2026_04_12_000007_add_accounts_scaling_indexes',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (37,'2026_04_12_000008_add_is_contact_to_account_fields_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (38,'2026_04_12_000009_normalize_user_flags_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (39,'2026_04_12_000017_create_account_domain_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (40,'2026_04_12_000018_add_file_columns_to_account_domain_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (41,'2026_04_12_000018_create_domains_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (42,'2026_04_13_000001_add_processing_columns_to_domains_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (43,'2026_04_13_000002_drop_legacy_account_domain_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (44,'2026_04_13_120000_add_emp_code_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (45,'2026_04_13_140000_allow_duplicate_contact_values_in_account_field_values',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (46,'2026_04_13_150000_create_account_field_value_histories_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (47,'2026_04_13_160000_add_domain_id_to_account_field_values_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (48,'2026_04_13_170000_add_domain_id_to_accounts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (49,'2026_04_13_180000_add_os_current_and_bucket_current_to_accounts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (50,'2026_04_13_190000_create_status_codes_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (51,'2026_04_13_190100_create_comments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (52,'2026_04_13_190200_add_assignment_fields_to_accounts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (53,'2026_04_13_190300_create_account_comment_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (54,'2026_04_18_000001_create_chat_conversations_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (55,'2026_04_18_000003_create_chat_messages_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (56,'2026_04_18_000004_create_chat_conversation_user_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (57,'2026_04_18_000005_create_break_sessions_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (58,'2026_04_18_000006_create_categories_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (59,'2026_04_18_000007_replace_account_status_code_with_category',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (60,'2026_04_18_000008_add_category_id_to_comments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (61,'2026_04_18_000009_create_account_contacts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (62,'2026_04_18_000010_restore_unique_on_account_field_values',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (63,'2026_04_23_000001_create_payment_updates_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (64,'2026_04_23_000002_create_payment_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (65,'2026_04_23_000003_add_bank_and_product_to_payment_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (66,'2026_04_23_000004_rename_payment_update_permissions_to_payment_import_permissions',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (67,'2026_04_23_000005_add_payments_permissions',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (68,'2026_04_25_000001_create_account_distribution_excel_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (69,'2026_04_25_000707_create_account_export_excel_records_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (70,'2026_04_25_003200_add_export_fields_to_account_export_excel_records_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (71,'2026_04_25_120000_create_domain_import_rows_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (72,'2026_04_25_180000_create_fingerprint_devices_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (73,'2026_04_25_190000_create_attendance_logs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (74,'2026_04_25_190001_add_last_synced_at_to_fingerprint_devices_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (75,'2026_04_26_000001_make_bank_product_nullable_in_account_export_excel_records',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (76,'2026_04_26_000002_make_bank_product_not_nullable_in_account_export_excel_records',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (77,'2026_04_28_000006_create_navigation_menu_orders_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (78,'2026_05_02_000001_create_companies_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (79,'2026_05_02_000002_create_managements_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (80,'2026_05_02_000003_create_departments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (81,'2026_05_02_000007_create_hr_profiles_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (82,'2026_05_02_000008_add_fingerprint_code_and_hr_profile_to_users',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (83,'2026_05_02_000010_add_hr_organization_fields_to_users',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (84,'2026_06_01_000002_add_account_field_id_value_index_to_account_field_values',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (85,'2026_06_01_000003_create_account_ptps_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (86,'2026_06_01_000004_decouple_account_ptps_from_comments_and_rename_date_column',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (87,'2026_06_01_000005_add_status_to_account_ptps_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (88,'2026_06_01_000006_create_actions_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (89,'2026_06_01_000007_refactor_actions_to_lookup_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (90,'2026_06_01_000009_create_account_payments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (91,'2026_06_01_000010_add_os_bucket_user_id_to_account_payments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (92,'2026_06_01_000010_create_account_attachments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (93,'2026_06_01_000011_add_comment_id_and_payment_import_id_to_account_payments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (94,'2026_06_01_000011_add_last_comment_at_to_accounts_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (95,'2026_06_01_000012_add_level_to_roles_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (96,'2026_06_01_000012_add_movement_name_to_payment_imports_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (97,'2026_06_01_000013_create_bank_main_product_user_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (98,'2026_06_01_000014_create_account_flags_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (99,'2026_06_01_000015_add_color_to_account_flags_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (100,'2026_06_02_000001_create_account_team_transfer_logs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (101,'2026_06_02_000002_replace_account_distribution_logs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (102,'2026_06_02_000003_rename_distribution_assignment_logs_table_and_columns',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (103,'2026_06_02_000004_create_account_open_logs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (104,'2026_06_02_000005_add_created_by_to_comments_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (105,'2026_06_02_000006_create_account_offers_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (106,'2026_06_02_000007_create_account_todos_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (107,'2026_06_03_000004_add_responsibles_and_department_employees',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (108,'2026_06_03_000005_add_hr_structure_permissions',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (109,'2026_06_03_000006_add_hr_structure_core_permissions',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (110,'2026_06_03_000008_add_hr_profiles_permissions',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (111,'2026_06_04_000001_add_salary_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (112,'2026_06_04_000001_add_second_approver_scope_to_departments',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (113,'2026_06_04_000002_create_hr_request_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (114,'2026_06_10_000001_create_user_vacation_balances_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (115,'2026_06_10_000002_add_hire_date_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (116,'2026_06_04_000003_add_hr_code_permissions',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (117,'2026_06_25_000001_create_allowances_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (118,'2026_06_25_000002_create_deductions_table',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (119,'2026_06_25_000003_add_allowances_and_deductions_permissions',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (120,'2026_06_25_000004_create_contracts_table',3);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (121,'2026_06_25_000005_add_contract_permissions',3);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (122,'2026_06_25_000006_create_contract_allowances_table',4);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (123,'2026_06_25_000007_create_contract_deductions_table',4);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (124,'2026_06_25_000008_add_default_cost_to_mission_requests_table',5);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (125,'2026_06_25_000009_add_working_days_to_hr_profiles_table',6);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (126,'2026_06_25_000010_drop_weekly_off_days_from_hr_profiles_table',7);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (127,'2026_06_25_000011_create_leave_types_table',8);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (128,'2026_06_25_000012_add_leave_type_id_to_leave_requests_table',8);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (129,'2026_06_25_000013_add_leave_types_permissions',8);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (130,'2026_06_25_000014_update_leave_types_and_hr_profiles_for_vacation_policy',9);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (131,'2026_06_25_000015_restore_name_en_on_leave_types',10);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (132,'2026_06_26_000016_create_holidays_table',11);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (133,'2026_06_26_000017_create_holiday_user_table',11);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (134,'2026_06_26_000018_add_holidays_permissions',11);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (135,'2026_06_26_000019_create_salary_advances_table',12);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (136,'2026_06_26_000020_create_salary_advance_installments_table',13);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (137,'2026_06_26_000021_add_salary_advances_permissions',13);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (138,'2026_06_26_000022_create_employee_monthly_allowances_table',14);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (139,'2026_06_26_000023_create_employee_monthly_deductions_table',14);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (140,'2026_06_26_000024_add_monthly_adjustments_permissions',14);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (141,'2026_06_26_000025_extend_chat_conversations_with_scope_types',15);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (142,'2026_06_26_000026_ensure_company_name_and_logo_settings',16);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (143,'2026_05_31_130000_create_attendance_import_files_table',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (144,'2026_05_31_130010_add_attendance_import_permissions',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (146,'2026_06_11_000001_create_action_leave_events_tables',18);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (147,'2026_06_11_000003_extend_settings_type_enum_for_date',19);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (148,'2026_06_11_000002_add_month_range_settings',20);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (149,'2026_06_11_000004_keep_only_month_start_setting',21);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (150,'2026_06_11_000005_update_month_start_setting_to_day_number',22);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (151,'2026_05_31_170000_add_global_period_settings',23);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (152,'2026_06_11_000006_add_mission_types_and_visit_cost_to_mission_requests',23);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (153,'2026_06_11_000007_create_monthly_allowances_and_deductions_tables',24);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (154,'2026_06_11_000008_add_monthly_adjustments_permissions',24);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (155,'2026_06_11_000009_add_late_delay_penalties_setting',25);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (156,'2026_06_11_000010_remove_unused_period_mode_settings',26);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (157,'2026_06_11_000011_rename_month_start_day_setting_title',27);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (158,'2026_06_11_000012_add_absence_penalties_setting',28);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (159,'2026_06_11_000013_add_all_target_type_to_action_leave_events',29);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (160,'2026_06_12_000001_add_name_en_to_companies_managements_and_departments',30);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (161,'2026_06_09_000001_drop_legacy_account_tables',31);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (162,'2026_06_09_000002_drop_legacy_domain_comment_category_tables',32);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (163,'2026_06_09_000003_drop_main_products_and_bank_main_product_user',33);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (164,'2026_06_12_000002_drop_teams_and_team_user',34);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (165,'2026_06_10_000000_create_branches_table',35);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (166,'2026_06_10_000001_add_branch_id_to_users_table',35);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (167,'2026_06_10_000002_add_source_to_attendance_logs_table',35);
