--
-- Host: localhost    Database: faceml_db
-- ------------------------------------------------------

--
-- Table structure for table `attendance`
--

CREATE TABLE `attendance` (
  `id` int NOT NULL AUTO_INCREMENT,
  `staff_id` int NOT NULL,
  `branch_id` int NOT NULL,
  `clock_in_time` timestamp NULL DEFAULT NULL,
  `clock_out_time` timestamp NULL DEFAULT NULL,
  `clock_in_location` varchar(255) DEFAULT NULL,
  `clock_out_location` varchar(255) DEFAULT NULL,
  `total_hours` decimal(5,2) DEFAULT NULL,
  `attendance_date` date NOT NULL,
  `status` enum('present','absent','half_day','on_leave') DEFAULT 'present',
  `notes` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_staff_id` (`staff_id`),
  KEY `idx_branch_id` (`branch_id`),
  KEY `idx_attendance_date` (`attendance_date`),
  KEY `idx_date_staff` (`attendance_date`,`staff_id`),
  CONSTRAINT `attendance_ibfk_1` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE CASCADE,
  CONSTRAINT `attendance_ibfk_2` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=577 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `attendance`
--

INSERT INTO `attendance` (`id`, `staff_id`, `branch_id`, `clock_in_time`, `clock_out_time`, `clock_in_location`, `clock_out_location`, `total_hours`, `attendance_date`, `status`, `notes`, `created_at`, `updated_at`) VALUES (426,34,3,'2025-10-30 03:30:00','2025-10-30 11:30:00',NULL,NULL,8.00,'2025-10-30','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(427,34,3,'2025-10-29 03:30:00','2025-10-29 11:30:00',NULL,NULL,8.00,'2025-10-29','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(428,34,3,'2025-10-28 03:30:00','2025-10-28 11:30:00',NULL,NULL,8.00,'2025-10-28','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(429,34,3,'2025-10-27 03:30:00','2025-10-27 11:30:00',NULL,NULL,8.00,'2025-10-27','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(430,34,3,'2025-10-24 03:30:00','2025-10-24 11:30:00',NULL,NULL,8.00,'2025-10-24','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(431,34,3,'2025-10-23 03:30:00','2025-10-23 11:30:00',NULL,NULL,8.00,'2025-10-23','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(432,34,3,'2025-10-22 03:30:00','2025-10-22 11:30:00',NULL,NULL,8.00,'2025-10-22','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(433,34,3,'2025-10-21 03:30:00','2025-10-21 11:30:00',NULL,NULL,8.00,'2025-10-21','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(434,34,3,'2025-10-20 03:30:00','2025-10-20 11:30:00',NULL,NULL,8.00,'2025-10-20','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(435,34,3,'2025-10-17 03:30:00','2025-10-17 11:30:00',NULL,NULL,8.00,'2025-10-17','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(436,34,3,'2025-10-16 03:30:00','2025-10-16 11:30:00',NULL,NULL,8.00,'2025-10-16','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(437,34,3,'2025-10-15 03:30:00','2025-10-15 11:30:00',NULL,NULL,8.00,'2025-10-15','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(438,34,3,'2025-10-14 03:30:00','2025-10-14 11:30:00',NULL,NULL,8.00,'2025-10-14','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(439,34,3,'2025-10-13 03:30:00','2025-10-13 11:30:00',NULL,NULL,8.00,'2025-10-13','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(440,34,3,'2025-10-10 03:30:00','2025-10-10 11:30:00',NULL,NULL,8.00,'2025-10-10','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(441,34,3,'2025-10-09 03:30:00','2025-10-09 11:30:00',NULL,NULL,8.00,'2025-10-09','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(442,34,3,'2025-10-08 03:30:00','2025-10-08 11:30:00',NULL,NULL,8.00,'2025-10-08','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(443,34,3,'2025-10-07 03:30:00','2025-10-07 11:30:00',NULL,NULL,8.00,'2025-10-07','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(444,34,3,'2025-10-06 03:30:00','2025-10-06 11:30:00',NULL,NULL,8.00,'2025-10-06','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(445,34,3,'2025-10-03 03:30:00','2025-10-03 11:30:00',NULL,NULL,8.00,'2025-10-03','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(446,34,3,'2025-10-02 03:30:00','2025-10-02 11:30:00',NULL,NULL,8.00,'2025-10-02','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(447,34,3,'2025-10-01 03:30:00','2025-10-01 11:30:00',NULL,NULL,8.00,'2025-10-01','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(448,34,3,'2025-09-30 03:30:00','2025-09-30 11:30:00',NULL,NULL,8.00,'2025-09-30','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(449,34,3,'2025-09-29 03:30:00','2025-09-29 11:30:00',NULL,NULL,8.00,'2025-09-29','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(450,34,3,'2025-09-26 03:30:00','2025-09-26 11:30:00',NULL,NULL,8.00,'2025-09-26','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(451,34,3,'2025-09-25 03:30:00','2025-09-25 11:30:00',NULL,NULL,8.00,'2025-09-25','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(452,34,3,'2025-09-24 03:30:00','2025-09-24 11:30:00',NULL,NULL,8.00,'2025-09-24','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(453,34,3,'2025-09-23 03:30:00','2025-09-23 11:30:00',NULL,NULL,8.00,'2025-09-23','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(454,34,3,'2025-09-22 03:30:00','2025-09-22 11:30:00',NULL,NULL,8.00,'2025-09-22','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(455,34,3,'2025-09-19 03:30:00','2025-09-19 11:30:00',NULL,NULL,8.00,'2025-09-19','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(456,34,3,'2025-09-18 03:30:00','2025-09-18 11:30:00',NULL,NULL,8.00,'2025-09-18','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(457,34,3,'2025-09-17 03:30:00','2025-09-17 11:30:00',NULL,NULL,8.00,'2025-09-17','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(458,34,3,'2025-09-16 03:30:00','2025-09-16 11:30:00',NULL,NULL,8.00,'2025-09-16','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(459,34,3,'2025-09-15 03:30:00','2025-09-15 11:30:00',NULL,NULL,8.00,'2025-09-15','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(460,34,3,'2025-09-12 03:30:00','2025-09-12 11:30:00',NULL,NULL,8.00,'2025-09-12','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(461,34,3,'2025-09-11 03:30:00','2025-09-11 11:30:00',NULL,NULL,8.00,'2025-09-11','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(462,34,3,'2025-09-10 03:30:00','2025-09-10 11:30:00',NULL,NULL,8.00,'2025-09-10','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(463,34,3,'2025-09-09 03:30:00','2025-09-09 11:30:00',NULL,NULL,8.00,'2025-09-09','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(464,34,3,'2025-09-08 03:30:00','2025-09-08 11:30:00',NULL,NULL,8.00,'2025-09-08','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(465,34,3,'2025-09-05 03:30:00','2025-09-05 11:30:00',NULL,NULL,8.00,'2025-09-05','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(466,34,3,'2025-09-04 03:30:00','2025-09-04 11:30:00',NULL,NULL,8.00,'2025-09-04','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(467,34,3,'2025-09-03 03:30:00','2025-09-03 11:30:00',NULL,NULL,8.00,'2025-09-03','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(468,34,3,'2025-09-02 03:30:00','2025-09-02 11:30:00',NULL,NULL,8.00,'2025-09-02','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(469,34,3,'2025-09-01 03:30:00','2025-09-01 11:30:00',NULL,NULL,8.00,'2025-09-01','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(470,34,3,'2025-08-29 03:30:00','2025-08-29 11:30:00',NULL,NULL,8.00,'2025-08-29','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(471,35,3,'2025-10-30 03:30:00','2025-10-30 11:30:00',NULL,NULL,8.00,'2025-10-30','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(472,35,3,'2025-10-29 02:30:00','2025-10-29 10:30:00',NULL,NULL,8.00,'2025-10-29','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(473,35,3,'2025-10-28 03:30:00','2025-10-28 09:30:00',NULL,NULL,6.00,'2025-10-28','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(474,35,3,'2025-10-27 03:30:00','2025-10-27 11:30:00',NULL,NULL,8.00,'2025-10-27','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(475,35,3,'2025-10-24 02:30:00','2025-10-24 10:30:00',NULL,NULL,8.00,'2025-10-24','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(476,35,3,'2025-10-23 03:30:00','2025-10-23 09:30:00',NULL,NULL,6.00,'2025-10-23','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(477,35,3,'2025-10-22 03:30:00','2025-10-22 11:30:00',NULL,NULL,8.00,'2025-10-22','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(478,35,3,'2025-10-21 02:30:00','2025-10-21 10:30:00',NULL,NULL,8.00,'2025-10-21','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(479,35,3,'2025-10-20 03:30:00','2025-10-20 09:30:00',NULL,NULL,6.00,'2025-10-20','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(480,35,3,'2025-10-17 03:30:00','2025-10-17 11:30:00',NULL,NULL,8.00,'2025-10-17','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(481,35,3,'2025-10-16 02:30:00','2025-10-16 10:30:00',NULL,NULL,8.00,'2025-10-16','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(482,35,3,'2025-10-15 03:30:00','2025-10-15 09:30:00',NULL,NULL,6.00,'2025-10-15','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(483,35,3,'2025-10-14 03:30:00','2025-10-14 11:30:00',NULL,NULL,8.00,'2025-10-14','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(484,35,3,'2025-10-13 02:30:00','2025-10-13 10:30:00',NULL,NULL,8.00,'2025-10-13','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(485,35,3,'2025-10-10 03:30:00','2025-10-10 09:30:00',NULL,NULL,6.00,'2025-10-10','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(486,35,3,'2025-10-09 03:30:00','2025-10-09 11:30:00',NULL,NULL,8.00,'2025-10-09','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(487,35,3,'2025-10-08 02:30:00','2025-10-08 10:30:00',NULL,NULL,8.00,'2025-10-08','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(488,35,3,'2025-10-07 03:30:00','2025-10-07 09:30:00',NULL,NULL,6.00,'2025-10-07','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(489,35,3,'2025-10-06 03:30:00','2025-10-06 11:30:00',NULL,NULL,8.00,'2025-10-06','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(490,35,3,'2025-10-03 02:30:00','2025-10-03 10:30:00',NULL,NULL,8.00,'2025-10-03','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(491,35,3,'2025-10-02 03:30:00','2025-10-02 09:30:00',NULL,NULL,6.00,'2025-10-02','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(492,35,3,'2025-10-01 03:30:00','2025-10-01 11:30:00',NULL,NULL,8.00,'2025-10-01','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(493,35,3,'2025-09-30 02:30:00','2025-09-30 10:30:00',NULL,NULL,8.00,'2025-09-30','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(494,35,3,'2025-09-29 03:30:00','2025-09-29 09:30:00',NULL,NULL,6.00,'2025-09-29','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(495,35,3,'2025-09-26 03:30:00','2025-09-26 11:30:00',NULL,NULL,8.00,'2025-09-26','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(496,35,3,'2025-09-25 02:30:00','2025-09-25 10:30:00',NULL,NULL,8.00,'2025-09-25','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(497,35,3,'2025-09-24 03:30:00','2025-09-24 09:30:00',NULL,NULL,6.00,'2025-09-24','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(498,35,3,'2025-09-23 03:30:00','2025-09-23 11:30:00',NULL,NULL,8.00,'2025-09-23','present','Shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(499,35,3,'2025-09-22 02:30:00','2025-09-22 10:30:00',NULL,NULL,8.00,'2025-09-22','present','Shift 8-4','2025-10-30 12:05:33','2025-10-30 12:05:33'),(500,35,3,'2025-09-19 03:30:00','2025-09-19 09:30:00',NULL,NULL,6.00,'2025-09-19','present','Shift 9-3','2025-10-30 12:05:33','2025-10-30 12:05:33'),(501,36,3,'2025-10-30 03:30:00','2025-10-30 11:30:00',NULL,NULL,8.00,'2025-10-30','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(502,36,3,'2025-10-29 03:30:00','2025-10-29 11:30:00',NULL,NULL,8.00,'2025-10-29','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(503,36,3,'2025-10-28 03:30:00','2025-10-28 11:30:00',NULL,NULL,8.00,'2025-10-28','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(504,36,3,'2025-10-27 03:30:00','2025-10-27 11:30:00',NULL,NULL,8.00,'2025-10-27','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(505,36,3,'2025-10-24 03:30:00','2025-10-24 11:30:00',NULL,NULL,8.00,'2025-10-24','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(506,36,3,'2025-10-22 03:30:00','2025-10-22 11:30:00',NULL,NULL,8.00,'2025-10-22','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(507,36,3,'2025-10-21 03:30:00','2025-10-21 11:30:00',NULL,NULL,8.00,'2025-10-21','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(508,36,3,'2025-10-17 03:30:00','2025-10-17 11:30:00',NULL,NULL,8.00,'2025-10-17','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(509,36,3,'2025-10-16 03:30:00','2025-10-16 11:30:00',NULL,NULL,8.00,'2025-10-16','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(510,36,3,'2025-10-15 03:30:00','2025-10-15 11:30:00',NULL,NULL,8.00,'2025-10-15','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(511,36,3,'2025-10-14 03:30:00','2025-10-14 11:30:00',NULL,NULL,8.00,'2025-10-14','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(512,36,3,'2025-10-13 03:30:00','2025-10-13 11:30:00',NULL,NULL,8.00,'2025-10-13','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(513,36,3,'2025-10-10 03:30:00','2025-10-10 11:30:00',NULL,NULL,8.00,'2025-10-10','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(514,36,3,'2025-10-09 03:30:00','2025-10-09 11:30:00',NULL,NULL,8.00,'2025-10-09','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(515,36,3,'2025-10-08 03:30:00','2025-10-08 11:30:00',NULL,NULL,8.00,'2025-10-08','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(516,36,3,'2025-10-07 03:30:00','2025-10-07 11:30:00',NULL,NULL,8.00,'2025-10-07','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(517,36,3,'2025-10-06 03:30:00','2025-10-06 11:30:00',NULL,NULL,8.00,'2025-10-06','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(518,36,3,'2025-10-03 03:30:00','2025-10-03 11:30:00',NULL,NULL,8.00,'2025-10-03','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(519,36,3,'2025-10-01 03:30:00','2025-10-01 11:30:00',NULL,NULL,8.00,'2025-10-01','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(520,36,3,'2025-09-30 03:30:00','2025-09-30 11:30:00',NULL,NULL,8.00,'2025-09-30','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(521,36,3,'2025-09-26 03:30:00','2025-09-26 11:30:00',NULL,NULL,8.00,'2025-09-26','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(522,36,3,'2025-09-25 03:30:00','2025-09-25 11:30:00',NULL,NULL,8.00,'2025-09-25','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(523,36,3,'2025-09-24 03:30:00','2025-09-24 11:30:00',NULL,NULL,8.00,'2025-09-24','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(524,36,3,'2025-09-23 03:30:00','2025-09-23 11:30:00',NULL,NULL,8.00,'2025-09-23','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(525,36,3,'2025-09-22 03:30:00','2025-09-22 11:30:00',NULL,NULL,8.00,'2025-09-22','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(526,36,3,'2025-09-19 03:30:00','2025-09-19 11:30:00',NULL,NULL,8.00,'2025-09-19','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(527,36,3,'2025-09-18 03:30:00','2025-09-18 11:30:00',NULL,NULL,8.00,'2025-09-18','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(528,36,3,'2025-09-17 03:30:00','2025-09-17 11:30:00',NULL,NULL,8.00,'2025-09-17','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(529,36,3,'2025-09-16 03:30:00','2025-09-16 11:30:00',NULL,NULL,8.00,'2025-09-16','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(530,36,3,'2025-09-15 03:30:00','2025-09-15 11:30:00',NULL,NULL,8.00,'2025-09-15','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(531,36,3,'2025-09-12 03:30:00','2025-09-12 11:30:00',NULL,NULL,8.00,'2025-09-12','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(532,36,3,'2025-09-10 03:30:00','2025-09-10 11:30:00',NULL,NULL,8.00,'2025-09-10','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(533,36,3,'2025-09-09 03:30:00','2025-09-09 11:30:00',NULL,NULL,8.00,'2025-09-09','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(534,36,3,'2025-09-05 03:30:00','2025-09-05 11:30:00',NULL,NULL,8.00,'2025-09-05','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(535,36,3,'2025-09-04 03:30:00','2025-09-04 11:30:00',NULL,NULL,8.00,'2025-09-04','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(536,36,3,'2025-09-03 03:30:00','2025-09-03 11:30:00',NULL,NULL,8.00,'2025-09-03','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(537,36,3,'2025-09-02 03:30:00','2025-09-02 11:30:00',NULL,NULL,8.00,'2025-09-02','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(538,36,3,'2025-09-01 03:30:00','2025-09-01 11:30:00',NULL,NULL,8.00,'2025-09-01','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(539,36,3,'2025-08-29 03:30:00','2025-08-29 11:30:00',NULL,NULL,8.00,'2025-08-29','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(540,36,3,'2025-08-28 03:30:00','2025-08-28 11:30:00',NULL,NULL,8.00,'2025-08-28','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(541,36,3,'2025-08-27 03:30:00','2025-08-27 11:30:00',NULL,NULL,8.00,'2025-08-27','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(542,36,3,'2025-08-26 03:30:00','2025-08-26 11:30:00',NULL,NULL,8.00,'2025-08-26','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(543,36,3,'2025-08-25 03:30:00','2025-08-25 11:30:00',NULL,NULL,8.00,'2025-08-25','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(544,36,3,'2025-08-22 03:30:00','2025-08-22 11:30:00',NULL,NULL,8.00,'2025-08-22','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(545,36,3,'2025-08-20 03:30:00','2025-08-20 11:30:00',NULL,NULL,8.00,'2025-08-20','present','Regular shift 9-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(546,37,3,'2025-10-30 04:30:00','2025-10-30 11:30:00',NULL,NULL,7.00,'2025-10-30','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(547,37,3,'2025-10-29 04:30:00','2025-10-29 11:30:00',NULL,NULL,7.00,'2025-10-29','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(548,37,3,'2025-10-28 04:30:00','2025-10-28 11:30:00',NULL,NULL,7.00,'2025-10-28','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(549,37,3,'2025-10-27 04:30:00','2025-10-27 11:30:00',NULL,NULL,7.00,'2025-10-27','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(550,37,3,'2025-10-24 04:30:00','2025-10-24 11:30:00',NULL,NULL,7.00,'2025-10-24','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(551,37,3,'2025-10-23 04:30:00','2025-10-23 11:30:00',NULL,NULL,7.00,'2025-10-23','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(552,37,3,'2025-10-22 04:30:00','2025-10-22 11:30:00',NULL,NULL,7.00,'2025-10-22','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(553,37,3,'2025-10-21 04:30:00','2025-10-21 11:30:00',NULL,NULL,7.00,'2025-10-21','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(554,37,3,'2025-10-20 04:30:00','2025-10-20 11:30:00',NULL,NULL,7.00,'2025-10-20','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(555,37,3,'2025-10-17 04:30:00','2025-10-17 11:30:00',NULL,NULL,7.00,'2025-10-17','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(556,37,3,'2025-10-16 04:30:00','2025-10-16 11:30:00',NULL,NULL,7.00,'2025-10-16','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(557,37,3,'2025-10-15 04:30:00','2025-10-15 11:30:00',NULL,NULL,7.00,'2025-10-15','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(558,37,3,'2025-10-14 04:30:00','2025-10-14 11:30:00',NULL,NULL,7.00,'2025-10-14','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(559,37,3,'2025-10-13 04:30:00','2025-10-13 11:30:00',NULL,NULL,7.00,'2025-10-13','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(560,37,3,'2025-10-10 04:30:00','2025-10-10 11:30:00',NULL,NULL,7.00,'2025-10-10','present','Regular shift 10-5','2025-10-30 12:05:33','2025-10-30 12:05:33'),(567,46,3,'2025-11-03 10:40:57','2025-11-03 10:41:13','Face Recognition','Face Recognition',-0.50,'2025-11-03','present',NULL,'2025-11-03 10:40:57','2025-11-19 12:11:54'),(571,46,3,'2025-11-19 05:09:14','2025-11-19 13:09:00','Manual Edit','Manual Edit',7.73,'2025-11-19','present',NULL,'2025-11-19 04:45:12','2025-11-19 12:19:41'),(572,46,3,'2025-11-19 05:09:14',NULL,'Face Recognition',NULL,NULL,'2025-11-19','present',NULL,'2025-11-19 05:09:14','2025-11-19 05:09:14'),(573,46,3,'2025-11-24 05:58:15','2025-11-24 06:01:18','Face Recognition','Face Recognition',0.05,'2025-11-24','present',NULL,'2025-11-24 05:58:15','2025-11-24 06:01:18'),(574,46,3,'2025-11-26 10:38:58','2025-11-26 10:40:41','Face Recognition','Face Recognition',0.03,'2025-11-26','present',NULL,'2025-11-26 10:38:58','2025-11-26 10:40:41'),(575,46,3,'2025-11-26 10:42:38','2025-11-26 10:42:41','Face Recognition','Face Recognition',0.00,'2025-11-26','present',NULL,'2025-11-26 10:42:38','2025-11-26 10:42:41'),(576,46,3,'2025-11-26 10:42:58',NULL,'Face Recognition',NULL,NULL,'2025-11-26','present',NULL,'2025-11-26 10:42:58','2025-11-26 10:42:58');

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

CREATE TABLE `branches` (
  `id` int NOT NULL AUTO_INCREMENT,
  `shop_id` int NOT NULL,
  `name` varchar(255) NOT NULL,
  `address` text,
  `contact_phone` varchar(20) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `pin` varchar(4) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_shop_id` (`shop_id`),
  CONSTRAINT `branches_ibfk_1` FOREIGN KEY (`shop_id`) REFERENCES `shops` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `branches` (`id`, `shop_id`, `name`, `address`, `contact_phone`, `is_active`, `created_at`, `updated_at`, `pin`) VALUES (3,3,'Main Branch',NULL,NULL,1,'2025-10-30 10:26:18','2025-10-30 10:26:18',NULL),(4,4,'Main Branch',NULL,NULL,1,'2025-11-21 04:37:57','2025-11-21 04:37:57',NULL),(5,5,'Main Branch',NULL,NULL,1,'2025-11-21 04:38:16','2025-11-21 04:38:16',NULL),(6,3,'Branch 2','secound brach',NULL,1,'2025-11-21 04:55:15','2025-11-21 04:55:15','1234');

--
-- Table structure for table `feature_flags`
--

CREATE TABLE `feature_flags` (
  `id` int NOT NULL AUTO_INCREMENT,
  `shop_id` int DEFAULT NULL,
  `feature_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_enabled` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_shop_feature` (`shop_id`,`feature_name`),
  CONSTRAINT `fk_feature_flags_shop` FOREIGN KEY (`shop_id`) REFERENCES `shops` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `feature_flags`
--

INSERT INTO `feature_flags` (`id`, `shop_id`, `feature_name`, `is_enabled`, `created_at`, `updated_at`) VALUES (1,NULL,'roster',1,'2025-11-19 04:10:47','2025-11-21 04:38:16'),(2,NULL,'availability',1,'2025-11-19 04:10:47','2025-11-21 04:41:23'),(3,5,'roster',0,'2025-11-21 04:38:16','2025-11-21 04:38:16'),(4,3,'roster',0,'2025-11-21 04:40:53','2025-11-26 03:57:40'),(5,3,'availability',0,'2025-11-21 04:40:54','2025-11-26 03:57:34'),(6,1,'roster',0,'2025-11-21 04:43:07','2025-11-21 04:43:07'),(7,5,'availability',0,'2025-11-26 03:57:38','2025-11-26 03:57:38'),(8,4,'availability',0,'2025-11-26 03:57:40','2025-11-26 03:57:40'),(9,4,'roster',0,'2025-11-26 03:57:40','2025-11-26 03:57:40'),(10,2,'availability',0,'2025-11-26 03:57:45','2025-11-26 03:57:45'),(11,2,'roster',0,'2025-11-26 03:57:46','2025-11-26 03:57:46'),(12,1,'availability',0,'2025-11-26 03:57:49','2025-11-26 03:57:49');

--
-- Table structure for table `roster_assignments`
--

CREATE TABLE `roster_assignments` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `branch_id` int NOT NULL,
  `shift_date` date NOT NULL,
  `staff_id` int NOT NULL,
  `shift_type_id` char(36) NOT NULL,
  `position_id` char(36) DEFAULT NULL,
  `start_minutes` int NOT NULL,
  `end_minutes` int NOT NULL,
  `break_type_ids` json DEFAULT NULL,
  `notes` text,
  `created_by_type` enum('shop_admin','staff') DEFAULT 'shop_admin',
  `created_by_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `position_id` (`position_id`),
  KEY `idx_branch_date` (`branch_id`,`shift_date`),
  KEY `idx_staff_date` (`staff_id`,`shift_date`),
  KEY `idx_shift_type_date` (`shift_type_id`,`shift_date`),
  CONSTRAINT `roster_assignments_ibfk_1` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `roster_assignments_ibfk_2` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE CASCADE,
  CONSTRAINT `roster_assignments_ibfk_3` FOREIGN KEY (`shift_type_id`) REFERENCES `roster_shift_types` (`id`) ON DELETE CASCADE,
  CONSTRAINT `roster_assignments_ibfk_4` FOREIGN KEY (`position_id`) REFERENCES `roster_positions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `roster_assignments`
--

INSERT INTO `roster_assignments` (`id`, `branch_id`, `shift_date`, `staff_id`, `shift_type_id`, `position_id`, `start_minutes`, `end_minutes`, `break_type_ids`, `notes`, `created_by_type`, `created_by_id`, `created_at`, `updated_at`) VALUES (9,3,'2025-11-19',47,'12cf293b-3ce7-4232-88d0-ff8d2c6cd1dc',NULL,540,660,'[\"f53af7cd-36e6-449c-9178-1a80dd83b570\"]',NULL,'shop_admin',5,'2025-11-16 12:40:58','2025-11-16 12:40:58');

--
-- Table structure for table `roster_break_types`
--

CREATE TABLE `roster_break_types` (
  `id` char(36) NOT NULL,
  `branch_id` int NOT NULL,
  `name` varchar(120) NOT NULL,
  `duration_minutes` int NOT NULL,
  `created_by` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_branch` (`branch_id`),
  CONSTRAINT `roster_break_types_ibfk_1` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `roster_break_types`
--

INSERT INTO `roster_break_types` (`id`, `branch_id`, `name`, `duration_minutes`, `created_by`, `created_at`, `updated_at`) VALUES ('f53af7cd-36e6-449c-9178-1a80dd83b570',3,'tea',15,5,'2025-11-16 12:39:50','2025-11-16 12:39:50');

--
-- Table structure for table `roster_positions`
--

CREATE TABLE `roster_positions` (
  `id` char(36) NOT NULL,
  `branch_id` int NOT NULL,
  `name` varchar(120) NOT NULL,
  `created_by` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_branch` (`branch_id`),
  CONSTRAINT `roster_positions_ibfk_1` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `roster_positions`
--

INSERT INTO `roster_positions` (`id`, `branch_id`, `name`, `created_by`, `created_at`, `updated_at`) VALUES ('016f6dad-b7dc-4f08-b6ae-8e6e6690b5bf',3,'stff',5,'2025-11-16 12:39:37','2025-11-16 12:39:37');

--
-- Table structure for table `roster_shift_types`
--

CREATE TABLE `roster_shift_types` (
  `id` char(36) NOT NULL,
  `branch_id` int NOT NULL,
  `name` varchar(120) NOT NULL,
  `start_minutes` int NOT NULL,
  `end_minutes` int NOT NULL,
  `created_by` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_branch` (`branch_id`),
  CONSTRAINT `roster_shift_types_ibfk_1` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `roster_shift_types`
--

INSERT INTO `roster_shift_types` (`id`, `branch_id`, `name`, `start_minutes`, `end_minutes`, `created_by`, `created_at`, `updated_at`) VALUES ('12cf293b-3ce7-4232-88d0-ff8d2c6cd1dc',3,'ñí]<þ',540,660,5,'2025-11-16 12:39:24','2025-11-16 12:39:24'),('fe14d4e2-d081-40ec-bbef-c337b9d1cf7a',3,'mor',540,660,5,'2025-11-16 12:39:19','2025-11-16 12:39:19');

--
-- Table structure for table `shops`
--

CREATE TABLE `shops` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `admin_id` int NOT NULL,
  `address` text,
  `contact_phone` varchar(20) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_admin_id` (`admin_id`),
  CONSTRAINT `shops_ibfk_1` FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `shops`
--

INSERT INTO `shops` (`id`, `name`, `admin_id`, `address`, `contact_phone`, `is_active`, `created_at`, `updated_at`) VALUES (1,'áb©',3,'áß',NULL,1,'2025-10-23 12:01:26','2025-10-23 12:01:26'),(2,'shop2\'s Shop',4,NULL,NULL,1,'2025-10-23 12:07:04','2025-10-23 12:07:04'),(3,'sahil',5,NULL,NULL,1,'2025-10-30 10:26:18','2025-10-30 10:26:18'),(4,'Test Shop 1763699877027',7,NULL,NULL,1,'2025-11-21 04:37:57','2025-11-21 04:37:57'),(5,'Test Shop 1763699896570',8,NULL,NULL,1,'2025-11-21 04:38:16','2025-11-21 04:38:16');

--
-- Table structure for table `staff`
--

CREATE TABLE `staff` (
  `id` int NOT NULL AUTO_INCREMENT,
  `branch_id` int NOT NULL,
  `staff_code` varchar(50) NOT NULL,
  `full_name` text COMMENT 'Encrypted',
  `email` text COMMENT 'Encrypted',
  `phone` text COMMENT 'Encrypted',
  `position` varchar(100) DEFAULT NULL,
  `hourly_rate` decimal(8,2) DEFAULT NULL,
  `face_embeddings` longtext COMMENT 'Encrypted string (was JSON)',
  `profile_image_path` text,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_code` (`staff_code`),
  KEY `idx_branch_id` (`branch_id`),
  KEY `idx_staff_code` (`staff_code`),
  CONSTRAINT `staff_ibfk_1` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `staff`
--

INSERT INTO `staff` (`id`, `branch_id`, `staff_code`, `full_name`, `email`, `phone`, `position`, `hourly_rate`, `face_embeddings`, `profile_image_path`, `is_active`, `created_at`, `updated_at`) VALUES (34,3,'STF002','dc960508895c5956bcc90d64f7d10f6b:87d1cb5e95b9a9dac4edff24f988df9e64:495dc2df094370db6ab4f834d59c2ecc','6006d3607a14c25e76583161a02d963b:1e1a167082b60ce25ad8dbdf:9eee7fc01942d8011965c35c87f72112','58f4657e1120b04b63e9ae49f26c0a1b:e53be5dee18ef38c98b1:8e26e440890a687a2b47269ce6c38d8f','Staff $15/hr',15.00,NULL,NULL,1,'2025-10-30 12:05:33','2025-11-24 05:19:07'),(35,3,'STF003','91f86dfad3b946340584b20bafc97d43:cd2a734405900455c01287aae4a7ade77dcc317cd76f854b:ab7e99789798279d80e1fa57b45e2a69','c22d114325e9aa2fff63a0323d514f00:97867013fdd424beaa115747793fd06b:85e4e356febce4d05098351148aa3858','6832b5518e61f8bd83baeecf924d824f:07eaa642917a33da2a77:48c662a014ded8e25c9fb2c6005f72c8','Staff $15/hr',15.00,NULL,NULL,1,'2025-10-30 12:05:33','2025-11-24 05:19:07'),(36,3,'STF004','ee419c1047637f767555e056ccd9b743:cc07b85238b71ffd9dd265d1d91ce39afa1033:b6f77e686cdc2c008fe4d4d7f1076700','6e41aad671f218f71684247c0c3b4237:2ac6322e99468453ae90ad8579ff:5ad105f8e0072027080ff352e62ce42d','fe05f8dd1cff81eff247880d26f482b6:b4f3baa2974cf37aff70:0038e1b291718f0a708e2af1c4a75a2c','Staff $15/hr',15.00,NULL,NULL,1,'2025-10-30 12:05:33','2025-11-24 05:19:07'),(37,3,'STF005','0727b62f7b69be4ec064476d2d625521:cdf29d14327dbafd7015bf7981b3fa5f2569:67e7a11f01c915f22be9fc7f9e85ec48','0cd01ce400b85694ee1566c53df89ed3:28a0c0cef226ceb9f2636fe2:576e40a1ca88a9c0230187480443aa1f','eca6c8bbb60d13481ac2efe150c93d3b:53797dc2eb0a487abbba:41e994ed902d7e808b1231671416175d','Staff $10/hr',10.00,NULL,NULL,1,'2025-10-30 12:05:33','2025-11-24 05:19:07'),(46,3,'B3-433989','63e4836570040fb6c758a1476b64df70:b42232123f:7aabc32c7efe65515ff0400b4522ef72',NULL,'b3f12efa65b51d3d063145f500830924:10260b66fc9dc5a44fa34028:fccae1971f2a42869036881d013ef903','staff',25.00,'81d10ced6f22f97736378b8523b65a44:[encoded data, 159808 characters]:7e9f66511f75e6485e537eceba5f76f3',NULL,1,'2025-11-03 10:40:51','2025-11-26 10:41:41'),(47,3,'B3-546467','38c9a630abb121555379960bd5461238:4a35f20c9c:23538b0f96d288080cbf01dc2cac64a3',NULL,'a8b67169eddb7de4adf64b8f51dc6330:fa1d454ee0b978ddc04d:e73f62ddffad702bcc5c60f77ad2849f','Frff',10.00,'184d899bd3c22b60fac67fdc016beec1:[encoded data, 117216 characters]:09ff89292c88544b94ced850a2367d7e',NULL,1,'2025-11-16 12:36:16','2025-11-26 10:41:41'),(48,3,'B3-614259','6574068fb8c215cb76ea797673a37bea:4d4d2ce0:96f3ce43a88fae4f9991f571a1523071',NULL,'2ab821ef44d9ece8390c99b3758f73f2:29b49d92bd091d82c7dd59:ca8ee960a2700263fa0a863ba4d6fc0e','staff',11.00,NULL,NULL,1,'2025-11-25 13:17:18','2025-11-25 13:17:18');

--
-- Table structure for table `staff_availability`
--

CREATE TABLE `staff_availability` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `staff_id` int NOT NULL,
  `branch_id` int NOT NULL,
  `availability_date` date NOT NULL,
  `is_available` tinyint(1) DEFAULT '1',
  `start_minutes` int DEFAULT NULL,
  `end_minutes` int DEFAULT NULL,
  `notes` text,
  `submitted_by` enum('staff','shop_admin') DEFAULT 'staff',
  `submitted_by_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_staff_availability` (`staff_id`,`availability_date`),
  KEY `idx_branch_date` (`branch_id`,`availability_date`),
  KEY `idx_staff_date` (`staff_id`,`availability_date`),
  CONSTRAINT `staff_availability_ibfk_1` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE CASCADE,
  CONSTRAINT `staff_availability_ibfk_2` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `staff_availability`
--

INSERT INTO `staff_availability` (`id`, `staff_id`, `branch_id`, `availability_date`, `is_available`, `start_minutes`, `end_minutes`, `notes`, `submitted_by`, `submitted_by_id`, `created_at`, `updated_at`) VALUES (1,47,3,'2025-11-17',1,540,1080,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30'),(2,47,3,'2025-11-18',1,540,1080,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30'),(3,47,3,'2025-11-19',0,NULL,NULL,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30'),(4,47,3,'2025-11-20',1,540,1080,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30'),(5,47,3,'2025-11-21',1,540,1080,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30'),(6,47,3,'2025-11-22',0,NULL,NULL,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30'),(7,47,3,'2025-11-23',0,NULL,NULL,NULL,'staff',47,'2025-11-16 12:37:30','2025-11-16 12:37:30');

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `full_name` varchar(255) NOT NULL,
  `role` enum('superadmin','shop_admin') NOT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  KEY `idx_email` (`email`),
  KEY `idx_role` (`role`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `email`, `password`, `full_name`, `role`, `is_active`, `created_at`, `updated_at`) VALUES (1,'admin@faceml.com','$2a$10$gMx4gnr4IByZvX1YdPXUR.X4PYYCTe3Rx0Cu6kWdHrMy08UMt9346','Super Admin','superadmin',1,'2025-10-23 11:48:23','2025-11-14 10:53:24'),(3,'shop1@gmail.com','$2a$10$a.ALYME7ibZxFyR7gu.RVORqi.RFzIw8fk5481.Wxj8eg0tc7n08G','sun','shop_admin',1,'2025-10-23 12:01:26','2025-10-23 12:01:26'),(4,'shop2@gmail.com','$2a$10$wtAf4giHMCmfRMi8CJZNyOUg2UQbmu23VNRFQLcMMykm4S/0TIzxO','shop2','shop_admin',1,'2025-10-23 12:07:04','2025-10-23 12:07:04'),(5,'shop@gmail.com','$2a$10$ubOXlCavStGBSu2/wpXwFuCF5jF/y8UOaTyB4DfXSC/5B0QUMJxKm','sahil','shop_admin',1,'2025-10-30 10:26:18','2025-10-30 10:26:18'),(7,'test_shop_1763699877027@example.com','$2a$10$nZ7Ij1y6/CwMflaOy/pGQuyovueAKjVrrLNKAmrOWe32CuHVf45gC','Test Shop Owner','shop_admin',1,'2025-11-21 04:37:57','2025-11-21 04:37:57'),(8,'test_shop_1763699896570@example.com','$2a$10$5t2JSxdU7R6xt/nl7C6Z5e/GG5xYUtjoeQyRzguFX.AUbb9MN0UMq','Test Shop Owner','shop_admin',1,'2025-11-21 04:38:16','2025-11-21 04:38:16');

--
-- Table structure for table `work_sessions`
--

CREATE TABLE `work_sessions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `attendance_id` int NOT NULL,
  `staff_id` int NOT NULL,
  `start_time` timestamp NOT NULL,
  `end_time` timestamp NULL DEFAULT NULL,
  `duration_minutes` int DEFAULT NULL,
  `session_type` enum('work','break','overtime') DEFAULT 'work',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_attendance_id` (`attendance_id`),
  KEY `idx_staff_id` (`staff_id`),
  CONSTRAINT `work_sessions_ibfk_1` FOREIGN KEY (`attendance_id`) REFERENCES `attendance` (`id`) ON DELETE CASCADE,
  CONSTRAINT `work_sessions_ibfk_2` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `work_sessions`
--

INSERT INTO `work_sessions` (`id`, `attendance_id`, `staff_id`, `start_time`, `end_time`, `duration_minutes`, `session_type`, `created_at`) VALUES (1,571,46,'2025-11-19 04:45:31','2025-11-19 04:46:12',1,'break','2025-11-19 04:45:31'),(4,571,46,'2025-11-19 04:45:00','2025-11-19 05:00:00',15,'break','2025-11-19 05:11:15'),(5,567,46,'2025-11-03 10:40:00','2025-11-03 10:55:00',15,'break','2025-11-19 12:11:41'),(6,567,46,'2025-11-03 11:40:00','2025-11-03 11:55:00',15,'break','2025-11-19 12:11:54'),(7,572,46,'2025-11-19 05:09:00',NULL,NULL,'break','2025-11-19 12:18:26');

--
-- Dumping events for database 'faceml_db'
--

--
-- Dumping routines for database 'faceml_db'
--


