-- MariaDB/MySQL dump for Visitorsprime. Import into an empty database.
-- This file replaces the SQLite export; do not run it against an existing populated schema.
SET FOREIGN_KEY_CHECKS=0;

CREATE TABLE IF NOT EXISTS `migrations` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `migration` VARCHAR(255) NOT NULL,
  `batch` INT NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `users` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `email` VARCHAR(255) NOT NULL,
  `email_verified_at` TIMESTAMP NULL DEFAULT NULL,
  `password` VARCHAR(255) NOT NULL,
  `role` ENUM('admin','staff','security') NOT NULL DEFAULT 'staff',
  `phone` VARCHAR(20) NULL,
  `department` VARCHAR(255) NULL,
  `designation` VARCHAR(255) NULL,
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `remember_token` VARCHAR(100) NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`),
  KEY `users_role_index` (`role`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `password_reset_tokens` (
  `email` VARCHAR(255) NOT NULL,
  `token` VARCHAR(255) NOT NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `sessions` (
  `id` VARCHAR(255) NOT NULL,
  `user_id` BIGINT UNSIGNED NULL,
  `ip_address` VARCHAR(45) NULL,
  `user_agent` TEXT NULL,
  `payload` LONGTEXT 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;

CREATE TABLE IF NOT EXISTS `cache` (
  `key` VARCHAR(255) NOT NULL,
  `value` MEDIUMTEXT NOT NULL,
  `expiration` INT NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `cache_locks` (
  `key` VARCHAR(255) NOT NULL,
  `owner` VARCHAR(255) NOT NULL,
  `expiration` INT NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_locks_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `jobs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `queue` VARCHAR(255) NOT NULL,
  `payload` LONGTEXT NOT NULL,
  `attempts` TINYINT UNSIGNED NOT NULL,
  `reserved_at` INT UNSIGNED 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;

CREATE TABLE IF NOT EXISTS `job_batches` (
  `id` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `total_jobs` INT NOT NULL,
  `pending_jobs` INT NOT NULL,
  `failed_jobs` INT NOT NULL,
  `failed_job_ids` LONGTEXT NOT NULL,
  `options` MEDIUMTEXT NULL,
  `cancelled_at` INT NULL,
  `created_at` INT NOT NULL,
  `finished_at` INT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `failed_jobs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `uuid` VARCHAR(255) NOT NULL,
  `connection` TEXT NOT NULL,
  `queue` TEXT NOT NULL,
  `payload` LONGTEXT NOT NULL,
  `exception` LONGTEXT 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;

CREATE TABLE IF NOT EXISTS `notifications` (
  `id` CHAR(36) NOT NULL,
  `type` VARCHAR(255) NOT NULL,
  `notifiable_type` VARCHAR(255) NOT NULL,
  `notifiable_id` BIGINT UNSIGNED NOT NULL,
  `data` TEXT NOT NULL,
  `read_at` TIMESTAMP NULL DEFAULT NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`, `notifiable_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `visitors` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `phone` VARCHAR(20) NOT NULL,
  `email` VARCHAR(255) NULL,
  `company` VARCHAR(255) NULL,
  `id_type` VARCHAR(50) NULL,
  `id_number` VARCHAR(100) NULL,
  `address` VARCHAR(500) NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  `photo_path` VARCHAR(255) NULL,
  `id_proof_path` VARCHAR(255) NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `visitors_phone_unique` (`phone`),
  KEY `visitors_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `appointments` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `reference` VARCHAR(30) NOT NULL,
  `visitor_id` BIGINT UNSIGNED NOT NULL,
  `host_id` BIGINT UNSIGNED NOT NULL,
  `created_by` BIGINT UNSIGNED NULL,
  `type` ENUM('scheduled','walk_in') NOT NULL DEFAULT 'scheduled',
  `purpose` VARCHAR(255) NOT NULL,
  `scheduled_at` DATETIME NOT NULL,
  `duration_minutes` SMALLINT UNSIGNED NULL,
  `vehicle_number` VARCHAR(30) NULL,
  `notes` TEXT NULL,
  `status` ENUM('pending','approved','rejected','checked_in','checked_out','cancelled','expired') NOT NULL DEFAULT 'approved',
  `otp_hash` VARCHAR(64) NULL,
  `otp_sent_at` TIMESTAMP NULL DEFAULT NULL,
  `otp_expires_at` TIMESTAMP NULL DEFAULT NULL,
  `otp_used_at` TIMESTAMP NULL DEFAULT NULL,
  `otp_verified_by` BIGINT UNSIGNED NULL,
  `approved_at` TIMESTAMP NULL DEFAULT NULL,
  `approved_by` BIGINT UNSIGNED NULL,
  `rejection_reason` VARCHAR(255) NULL,
  `cancelled_at` TIMESTAMP NULL DEFAULT NULL,
  `badge_number` VARCHAR(30) NULL,
  `checked_in_at` TIMESTAMP NULL DEFAULT NULL,
  `checked_in_by` BIGINT UNSIGNED NULL,
  `checked_out_at` TIMESTAMP NULL DEFAULT NULL,
  `checked_out_by` BIGINT UNSIGNED NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  `otp_code` TEXT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `appointments_reference_unique` (`reference`),
  KEY `appointments_scheduled_at_index` (`scheduled_at`),
  KEY `appointments_status_index` (`status`),
  KEY `appointments_otp_hash_index` (`otp_hash`),
  CONSTRAINT `appointments_visitor_id_foreign` FOREIGN KEY (`visitor_id`) REFERENCES `visitors` (`id`) ON DELETE CASCADE,
  CONSTRAINT `appointments_host_id_foreign` FOREIGN KEY (`host_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `appointments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `appointments_otp_verified_by_foreign` FOREIGN KEY (`otp_verified_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `appointments_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `appointments_checked_in_by_foreign` FOREIGN KEY (`checked_in_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `appointments_checked_out_by_foreign` FOREIGN KEY (`checked_out_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `notification_logs` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `appointment_id` BIGINT UNSIGNED NULL,
  `channel` ENUM('sms','email') NOT NULL,
  `recipient` VARCHAR(255) NOT NULL,
  `subject` VARCHAR(255) NULL,
  `message` TEXT NOT NULL,
  `driver` VARCHAR(30) NOT NULL,
  `status` ENUM('sent','logged','failed') NOT NULL,
  `error` TEXT NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `notification_logs_status_index` (`status`),
  CONSTRAINT `notification_logs_appointment_id_foreign` FOREIGN KEY (`appointment_id`) REFERENCES `appointments` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `settings` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `key` VARCHAR(255) NOT NULL,
  `value` TEXT 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;

CREATE TABLE IF NOT EXISTS `security_alerts` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` ENUM('panic','duress') NOT NULL,
  `raised_by` BIGINT UNSIGNED NULL,
  `note` VARCHAR(255) NULL,
  `ip_address` VARCHAR(45) NULL,
  `user_agent` VARCHAR(255) NULL,
  `acknowledged_at` TIMESTAMP NULL DEFAULT NULL,
  `acknowledged_by` BIGINT UNSIGNED NULL,
  `resolution` VARCHAR(500) NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `security_alerts_type_index` (`type`),
  KEY `security_alerts_acknowledged_at_index` (`acknowledged_at`),
  CONSTRAINT `security_alerts_raised_by_foreign` FOREIGN KEY (`raised_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `security_alerts_acknowledged_by_foreign` FOREIGN KEY (`acknowledged_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO migrations VALUES(1,'0001_01_01_000000_create_users_table',1);
INSERT INTO migrations VALUES(2,'0001_01_01_000001_create_cache_table',1);
INSERT INTO migrations VALUES(3,'0001_01_01_000002_create_jobs_table',1);
INSERT INTO migrations VALUES(4,'2026_10_23_163657_create_notifications_table',1);
INSERT INTO migrations VALUES(5,'2026_10_23_163659_create_visitors_table',1);
INSERT INTO migrations VALUES(6,'2026_10_23_163701_create_appointments_table',1);
INSERT INTO migrations VALUES(7,'2026_10_23_163703_create_notification_logs_table',1);
INSERT INTO migrations VALUES(8,'2026_10_23_163705_create_settings_table',1);
INSERT INTO migrations VALUES(9,'2026_10_23_171912_add_otp_code_to_appointments_table',1);
INSERT INTO migrations VALUES(10,'2026_10_26_000000_add_media_paths_to_visitors_table',2);
INSERT INTO migrations VALUES(11,'2026_10_26_120000_encrypt_secret_settings',3);
INSERT INTO migrations VALUES(12,'2026_10_27_000000_create_security_alerts_table',4);
INSERT INTO users VALUES(1,'System Admin','admin@vms.test',NULL,'$2y$12$3yChyXaAaylhyY7w1.mVpeyvC2WgvdM43kQMo74nYSz38OgBwuMlW','admin','9000000001','Administration','Facility Manager',1,NULL,'2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO users VALUES(2,'Priya Sharma','staff@vms.test',NULL,'$2y$12$hL.nkeLBJZFMn02XmY128.BVrEQ2KVIaRCK.8hWnWqqJdv7UMYLHi','staff','9000000002','Human Resources','HR Manager',1,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO users VALUES(3,'Rahul Verma','rahul@vms.test',NULL,'$2y$12$mnXmkgq3vgTh6O7AfocBjOQxkpwn6aALqIeFPDgoWk5ni8Wctzi8u','staff','9000000003','Engineering','Tech Lead',1,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO users VALUES(4,'Front Desk','security@vms.test',NULL,'$2y$12$geuz2NykTQgQJ3A/UhOJqO0vakcJUPVDnz9C5EZc.E0iDuTE/9OKK','security','9000000004','Security','Reception',1,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO users VALUES(5,'Ramesh Guard','guard@vms.test',NULL,'$2y$12$.o9lO1RzQz7w3bpyo4DVjOmRlo3M4A7G6j4p8rR7nD1SiL0Xa.dMO','security','9000000005','Security','Security Officer',1,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notifications VALUES('63fbe30a-6169-402f-9fbe-acc7ac9a1bf0','App\\Notifications\\VisitAlert','App\\Models\\User',4,'{"title":"Walk-in approved","body":"Priya Sharma approved Meera Nair (VMS-261026-30EZR). OTP sent to visitor.","url":"http:\\/\\/127.0.0.1:8000\\/appointments\\/22","icon":"check-circle","color":"success"}',NULL,'2026-10-26 15:00:26','2026-10-26 15:00:26');
INSERT INTO notifications VALUES('bd175594-68df-47b1-ae58-db812dea33cd','App\\Notifications\\VisitAlert','App\\Models\\User',5,'{"title":"Walk-in approved","body":"Priya Sharma approved Meera Nair (VMS-261026-30EZR). OTP sent to visitor.","url":"http:\\/\\/127.0.0.1:8000\\/appointments\\/22","icon":"check-circle","color":"success"}',NULL,'2026-10-26 15:00:26','2026-10-26 15:00:26');
INSERT INTO visitors VALUES(1,'Anil Kumar','9876500001','anil@globex.test','Globex Ltd','Aadhaar','XXXX-XXXX-1234','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(2,'Sneha Patel','9876500002','sneha@initech.test','Initech','PAN','ABCDE1234F','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(3,'John Mathew','9876500003','john@umbrella.test','Umbrella Corp','Passport','P1234567','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(4,'Fatima Khan','9876500004','fatima@mail.test',NULL,'Driving License','DL-0420110012345','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(5,'Vikram Singh','9876500005','vikram@stark.test','Stark Industries','Company ID','STK-889','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(6,'Meera Nair','9876500006','meera@wayne.test','Wayne Enterprises','Aadhaar','XXXX-XXXX-5678','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(7,'Courier - BlueDart','9876500007',NULL,'BlueDart',NULL,NULL,'Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO visitors VALUES(8,'Arjun Reddy','9876500008','arjun@hooli.test','Hooli','Voter ID','VTR1234567','Bengaluru, Karnataka','2026-10-26 13:38:32','2026-10-26 13:38:32',NULL,NULL);
INSERT INTO appointments VALUES(1,'VMS-261026-MJGQF',7,2,2,'scheduled','Maintenance / Service','2026-10-24 14:15:00',30,NULL,NULL,'checked_out',NULL,'2026-10-23 14:15:00','2026-10-24 16:15:00','2026-10-24 14:27:00',5,'2026-10-23 14:15:00',2,NULL,NULL,'V-001','2026-10-24 14:27:00',5,'2026-10-24 15:57:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(2,'VMS-261026-ZM0IP',2,1,2,'scheduled','Vendor discussion','2026-10-21 10:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-20 10:45:00','2026-10-21 12:45:00','2026-10-21 10:42:00',5,'2026-10-20 10:45:00',1,NULL,NULL,'V-002','2026-10-21 10:42:00',5,'2026-10-21 12:37:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(3,'VMS-261026-H6AOM',2,2,2,'scheduled','Delivery','2026-10-20 09:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-19 09:45:00','2026-10-20 11:45:00','2026-10-20 09:41:00',5,'2026-10-19 09:45:00',2,NULL,NULL,'V-003','2026-10-20 09:41:00',5,'2026-10-20 11:27:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(4,'VMS-261026-Z9YGV',7,1,2,'walk_in','Vendor discussion','2026-10-25 16:15:00',30,NULL,NULL,'checked_out',NULL,'2026-10-24 16:15:00','2026-10-25 18:15:00','2026-10-25 16:21:00',5,'2026-10-24 16:15:00',1,NULL,NULL,'V-004','2026-10-25 16:21:00',5,'2026-10-25 16:43:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(5,'VMS-261026-EUDAB',3,2,2,'scheduled','Vendor discussion','2026-10-23 09:15:00',30,NULL,NULL,'checked_out',NULL,'2026-10-22 09:15:00','2026-10-23 11:15:00','2026-10-23 09:08:00',5,'2026-10-22 09:15:00',2,NULL,NULL,'V-005','2026-10-23 09:08:00',5,'2026-10-23 10:47:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(6,'VMS-261026-KABDZ',4,3,2,'scheduled','Business meeting','2026-10-23 16:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-22 16:45:00','2026-10-23 18:45:00','2026-10-23 16:50:00',5,'2026-10-22 16:45:00',3,NULL,NULL,'V-006','2026-10-23 16:50:00',5,'2026-10-23 18:45:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(7,'VMS-261026-XHWBJ',6,1,2,'scheduled','Interview','2026-10-21 17:00:00',30,NULL,NULL,'checked_out',NULL,'2026-10-20 17:00:00','2026-10-21 19:00:00','2026-10-21 17:01:00',5,'2026-10-20 17:00:00',1,NULL,NULL,'V-007','2026-10-21 17:01:00',5,'2026-10-21 18:54:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(8,'VMS-261026-9CUSB',2,1,2,'walk_in','Vendor discussion','2026-10-22 17:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-21 17:45:00','2026-10-22 19:45:00','2026-10-22 17:59:00',5,'2026-10-21 17:45:00',1,NULL,NULL,'V-008','2026-10-22 17:59:00',5,'2026-10-22 19:02:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(9,'VMS-261026-8W2N0',2,1,2,'scheduled','Interview','2026-10-21 10:00:00',30,NULL,NULL,'checked_out',NULL,'2026-10-20 10:00:00','2026-10-21 12:00:00','2026-10-21 10:09:00',5,'2026-10-20 10:00:00',1,NULL,NULL,'V-009','2026-10-21 10:09:00',5,'2026-10-21 11:31:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(10,'VMS-261026-VYYVD',4,1,2,'scheduled','Vendor discussion','2026-10-23 16:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-22 16:45:00','2026-10-23 18:45:00','2026-10-23 16:57:00',5,'2026-10-22 16:45:00',1,NULL,NULL,'V-010','2026-10-23 16:57:00',5,'2026-10-23 18:23:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(11,'VMS-261026-F1EDA',8,1,2,'scheduled','Business meeting','2026-10-22 11:30:00',30,NULL,NULL,'checked_out',NULL,'2026-10-21 11:30:00','2026-10-22 13:30:00','2026-10-22 11:22:00',5,'2026-10-21 11:30:00',1,NULL,NULL,'V-011','2026-10-22 11:22:00',5,'2026-10-22 13:05:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(12,'VMS-261026-M0T68',2,3,2,'walk_in','Vendor discussion','2026-10-21 16:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-20 16:45:00','2026-10-21 18:45:00','2026-10-21 16:44:00',5,'2026-10-20 16:45:00',3,NULL,NULL,'V-012','2026-10-21 16:44:00',5,'2026-10-21 18:40:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(13,'VMS-261026-AJLMJ',8,1,2,'scheduled','Interview','2026-10-23 15:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-22 15:45:00','2026-10-23 17:45:00','2026-10-23 15:43:00',5,'2026-10-22 15:45:00',1,NULL,NULL,'V-013','2026-10-23 15:43:00',5,'2026-10-23 17:24:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(14,'VMS-261026-FKJLY',2,2,2,'scheduled','Maintenance / Service','2026-10-21 16:15:00',30,NULL,NULL,'checked_out',NULL,'2026-10-20 16:15:00','2026-10-21 18:15:00','2026-10-21 16:16:00',5,'2026-10-20 16:15:00',2,NULL,NULL,'V-014','2026-10-21 16:16:00',5,'2026-10-21 17:06:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(15,'VMS-261026-WIIFL',2,2,2,'scheduled','Maintenance / Service','2026-10-24 10:30:00',30,NULL,NULL,'checked_out',NULL,'2026-10-23 10:30:00','2026-10-24 12:30:00','2026-10-24 10:35:00',5,'2026-10-23 10:30:00',2,NULL,NULL,'V-015','2026-10-24 10:35:00',5,'2026-10-24 11:15:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(16,'VMS-261026-QYJ4K',7,3,2,'walk_in','Maintenance / Service','2026-10-20 11:45:00',30,NULL,NULL,'checked_out',NULL,'2026-10-19 11:45:00','2026-10-20 13:45:00','2026-10-20 11:57:00',5,'2026-10-19 11:45:00',3,NULL,NULL,'V-016','2026-10-20 11:57:00',5,'2026-10-20 13:11:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(17,'VMS-261026-SSUUE',6,1,2,'scheduled','Delivery','2026-10-21 10:15:00',30,NULL,NULL,'checked_out',NULL,'2026-10-20 10:15:00','2026-10-21 12:15:00','2026-10-21 10:26:00',5,'2026-10-20 10:15:00',1,NULL,NULL,'V-017','2026-10-21 10:26:00',5,'2026-10-21 12:01:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(18,'VMS-261026-BDIBR',8,3,2,'scheduled','Delivery','2026-10-23 14:00:00',30,NULL,NULL,'checked_out',NULL,'2026-10-22 14:00:00','2026-10-23 16:00:00','2026-10-23 13:53:00',5,'2026-10-22 14:00:00',3,NULL,NULL,'V-018','2026-10-23 13:53:00',5,'2026-10-23 14:19:00',5,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(19,'VMS-261026-O1K2Z',7,3,5,'walk_in','Delivery','2026-10-25 11:00:00',NULL,NULL,NULL,'rejected',NULL,NULL,NULL,NULL,NULL,NULL,3,'Please leave the parcel at reception.',NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(20,'VMS-261026-CVZPY',8,2,2,'scheduled','Interview','2026-10-25 15:00:00',NULL,NULL,NULL,'cancelled',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-24 13:38:32',NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(21,'VMS-261026-QO7QQ',5,3,3,'scheduled','Project review','2026-10-26 12:38:32',90,NULL,NULL,'checked_in',NULL,'2026-10-25 13:38:32','2026-10-26 14:38:32','2026-10-26 12:43:32',5,'2026-10-25 13:38:32',3,NULL,NULL,'V-101','2026-10-26 12:43:32',5,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32',NULL);
INSERT INTO appointments VALUES(22,'VMS-261026-30EZR',6,2,5,'walk_in','Personal visit','2026-10-26 13:33:32',NULL,NULL,NULL,'expired','21c2c0cb642f89b7600ad1af410feef7aa270c840d3ec7e5aa1f3bbb630aa021','2026-10-26 15:00:26','2026-10-26 17:00:26',NULL,NULL,'2026-10-26 15:00:26',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 17:08:36','eyJpdiI6IkQ4aXRod1JMUUE2VkpocUNyZTk4Umc9PSIsInZhbHVlIjoiT3lSejdnTklWcjVhaWxaTlB1K3BsUT09IiwibWFjIjoiZDk1ODBiYTVkNDNlNzEyYmYxM2UzOWY0MzhkYmIyMDUxNmFkZGQwNjAxNTMwYTc1M2RkMWFjZTUzNmQzZDRjNiIsInRhZyI6IiJ9');
INSERT INTO appointments VALUES(23,'VMS-261026-E2OIQ',1,2,2,'scheduled','Business meeting','2026-10-26 14:00:00',45,NULL,NULL,'expired','9ebf28a21987e670e583ba54cc6c9250e782492ac34fceba84c87473a8243625','2026-10-26 13:38:32','2026-10-26 16:00:00',NULL,NULL,'2026-10-26 13:38:32',2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 17:08:36','eyJpdiI6InMxY1FGb2ltYklKdlNhVVRlaVROSkE9PSIsInZhbHVlIjoiQnp1RW5BWS94OE1yTUZUcDBhTmk0QT09IiwibWFjIjoiYTgzYjE1NmEyNGI4MjQxMzk1ODgxYTRhYzgyYTliZWQ0Y2IzZGZjNGZhYWI5MmY1OWEwNjczYWEwZTBlMjMwMyIsInRhZyI6IiJ9');
INSERT INTO appointments VALUES(24,'VMS-261026-8EON8',2,2,2,'scheduled','Interview','2026-10-26 16:00:00',45,NULL,NULL,'expired','d2489a17b1b5f3cd2fd5aae62855059a3feb580dfe2f1de62a348383d524dab0','2026-10-26 13:38:32','2026-10-26 18:00:00',NULL,NULL,'2026-10-26 13:38:32',2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-27 00:01:38','eyJpdiI6Im9qcjJJZTZPTnlueVp2V3ZrSHhCbEE9PSIsInZhbHVlIjoiZGdGZFhydjF5MXRkZDI2WVFWa09hUT09IiwibWFjIjoiYzJmNDE5ZGU1MzU0MTdmY2FjZjk5ZjJhOTljMjU4ZGRiNzQ5YmFmMzRkNmQ4YzgzMjJiOThiZGI3MGYyZmQ5OSIsInRhZyI6IiJ9');
INSERT INTO appointments VALUES(25,'VMS-261026-IOAJ9',3,3,3,'scheduled','Vendor discussion','2026-10-27 11:00:00',45,NULL,NULL,'approved','df71750036f33eec7e9fc8c43b3be846c6cb3523896c0e75cbaeb83cb1957768','2026-10-26 13:38:32','2026-10-27 13:00:00',NULL,NULL,'2026-10-26 13:38:32',3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32','eyJpdiI6IlZLUm9XR1lyN1N5QkJCVFV0ZVZTSEE9PSIsInZhbHVlIjoiZkkvc0l4OTkraFhtOC9PdWdzT0NDUT09IiwibWFjIjoiZWViODZkZGUxNDQ1YTg0ZjU4NTE0ZTQxNDE2MzgzNjQzYjk1MWVlMmMxOGQ5OTE1NGU3ZTBmNmExZTg5ODkyMyIsInRhZyI6IiJ9');
INSERT INTO appointments VALUES(26,'VMS-261026-O7IUO',4,1,1,'scheduled','Maintenance / Service','2026-10-28 14:30:00',45,NULL,NULL,'approved','81cd63df96603c00f39d864665f4fe201f97d9fa9f21bcc50e8f6aedd21cc2d4','2026-10-26 13:38:32','2026-10-28 16:30:00',NULL,NULL,'2026-10-26 13:38:32',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32','eyJpdiI6IlI3SjgxT0QxZGUvWENDMDhQb3Z0T2c9PSIsInZhbHVlIjoibkhIamxlVzZDdVczSTJkR0pYOG1QZz09IiwibWFjIjoiZTJjYTExYTZlOWZlNDdjY2UwYWJlZjU4ZGI5MWE2NjdmMjA5NjVmYWI1ZWFiZTk3ZTc5ZTE4YjA4YTVlNzI1MSIsInRhZyI6IiJ9');
INSERT INTO notification_logs VALUES(1,23,'sms','9876500001',NULL,'Dear Anil Kumar, your visit to Acme Corporation with Priya Sharma on 26 Oct 2026, 02:00 PM is confirmed. Your one-time entry OTP is 795840 (Ref VMS-261026-E2OIQ). Valid till 26 Oct 2026, 04:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(2,23,'email','anil@globex.test','Your visit OTP - VMS-261026-E2OIQ','Dear Anil Kumar, your visit to Acme Corporation with Priya Sharma on 26 Oct 2026, 02:00 PM is confirmed. Your one-time entry OTP is 795840 (Ref VMS-261026-E2OIQ). Valid till 26 Oct 2026, 04:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(3,24,'sms','9876500002',NULL,'Dear Sneha Patel, your visit to Acme Corporation with Priya Sharma on 26 Oct 2026, 04:00 PM is confirmed. Your one-time entry OTP is 560737 (Ref VMS-261026-8EON8). Valid till 26 Oct 2026, 06:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(4,24,'email','sneha@initech.test','Your visit OTP - VMS-261026-8EON8','Dear Sneha Patel, your visit to Acme Corporation with Priya Sharma on 26 Oct 2026, 04:00 PM is confirmed. Your one-time entry OTP is 560737 (Ref VMS-261026-8EON8). Valid till 26 Oct 2026, 06:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(5,25,'sms','9876500003',NULL,'Dear John Mathew, your visit to Acme Corporation with Rahul Verma on 27 Oct 2026, 11:00 AM is confirmed. Your one-time entry OTP is 350136 (Ref VMS-261026-IOAJ9). Valid till 27 Oct 2026, 01:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(6,25,'email','john@umbrella.test','Your visit OTP - VMS-261026-IOAJ9','Dear John Mathew, your visit to Acme Corporation with Rahul Verma on 27 Oct 2026, 11:00 AM is confirmed. Your one-time entry OTP is 350136 (Ref VMS-261026-IOAJ9). Valid till 27 Oct 2026, 01:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(7,26,'sms','9876500004',NULL,'Dear Fatima Khan, your visit to Acme Corporation with System Admin on 28 Oct 2026, 02:30 PM is confirmed. Your one-time entry OTP is 528729 (Ref VMS-261026-O7IUO). Valid till 28 Oct 2026, 04:30 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(8,26,'email','fatima@mail.test','Your visit OTP - VMS-261026-O7IUO','Dear Fatima Khan, your visit to Acme Corporation with System Admin on 28 Oct 2026, 02:30 PM is confirmed. Your one-time entry OTP is 528729 (Ref VMS-261026-O7IUO). Valid till 28 Oct 2026, 04:30 PM. Show it at reception.','log','logged',NULL,'2026-10-26 13:38:32','2026-10-26 13:38:32');
INSERT INTO notification_logs VALUES(9,22,'sms','9876500006',NULL,'Dear Meera Nair, your visit to Acme Corporation with Priya Sharma on 26 Oct 2026, 01:33 PM is confirmed. Your one-time entry OTP is 274770 (Ref VMS-261026-30EZR). Valid till 26 Oct 2026, 05:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 15:00:26','2026-10-26 15:00:26');
INSERT INTO notification_logs VALUES(10,22,'email','meera@wayne.test','Your visit OTP - VMS-261026-30EZR','Dear Meera Nair, your visit to Acme Corporation with Priya Sharma on 26 Oct 2026, 01:33 PM is confirmed. Your one-time entry OTP is 274770 (Ref VMS-261026-30EZR). Valid till 26 Oct 2026, 05:00 PM. Show it at reception.','log','logged',NULL,'2026-10-26 15:00:26','2026-10-26 15:00:26');
INSERT INTO settings VALUES(1,'company_name','Acme Corporation','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(2,'otp_length','6','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(3,'otp_expiry_minutes','120','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(4,'otp_channels','sms,email','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(5,'notify_host_channels','email','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(6,'sms_driver','log','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(7,'twilio_sid','','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(8,'twilio_token','','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(9,'twilio_from','','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(10,'sms_http_url','','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(11,'sms_http_api_key','','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(12,'sms_http_sender','','2026-10-26 13:38:31','2026-10-26 13:38:31');
INSERT INTO settings VALUES(13,'email_enabled','1','2026-10-26 13:38:31','2026-10-26 13:38:31');

SET FOREIGN_KEY_CHECKS=1;
