-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               10.4.32-MariaDB - mariadb.org binary distribution
-- Server OS:                    Win64
-- HeidiSQL Version:             12.12.0.7122
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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 */;


-- Dumping database structure for cms_db
CREATE DATABASE IF NOT EXISTS `cms_db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
USE `cms_db`;

-- Dumping structure for table cms_db.audit_logs
CREATE TABLE IF NOT EXISTS `audit_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `action` varchar(100) NOT NULL,
  `target_type` varchar(100) DEFAULT NULL,
  `target_id` int(11) DEFAULT NULL,
  `target_name` varchar(255) DEFAULT NULL,
  `details` text DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_action` (`action`),
  KEY `idx_target_type` (`target_type`),
  KEY `idx_target_id` (`target_id`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_audit_logs_user_action_created` (`user_id`,`action`,`created_at`),
  CONSTRAINT `audit_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `audit_logs_ibfk_2` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.audit_logs: ~11 rows (approximately)
INSERT IGNORE INTO `audit_logs` (`id`, `user_id`, `action`, `target_type`, `target_id`, `target_name`, `details`, `ip_address`, `user_agent`, `created_at`) VALUES
	(1, 2, 'USER_UPDATED', 'user', 2, 'Super Admin', 'name from "Admiral Sheikh Nazrul Islam" to "Super Admin"; ', NULL, NULL, '2025-10-07 11:41:54'),
	(2, 3, 'USER_UPDATED', 'user', 3, 'Admin', 'name from "Rear Admiral Mohammad Ali" to "Admin"; ', NULL, NULL, '2025-10-07 11:41:58'),
	(3, 4, 'USER_UPDATED', 'user', 4, 'Nave HQ', 'name from "User" to "Nave HQ"; ', NULL, NULL, '2025-10-09 19:51:36'),
	(4, 4, 'USER_UPDATED', 'user', 4, 'Nave HQ', 'email from "user@gmail.com" to "naveadmin@gmail.com"; ', NULL, NULL, '2025-10-09 19:52:32'),
	(5, 26, 'USER_UPDATED', 'user', 26, 'Commander Lisa Davis1111', 'name from "Commander Lisa Davis" to "Commander Lisa Davis1111"; ', NULL, NULL, '2025-10-10 11:41:06'),
	(6, 26, 'USER_UPDATED', 'user', 26, 'Commander Lisa Davis1111', 'phone from "+880211111123" to "+88021111112334343";', NULL, NULL, '2025-10-10 12:02:08'),
	(7, 4, 'USER_UPDATED', 'user', 4, 'NHQ Admin', 'name from "Nave HQ" to "NHQ Admin"; ', NULL, NULL, '2025-10-10 15:02:18'),
	(8, 4, 'USER_UPDATED', 'user', 4, 'NHQ Admin', 'phone from "01756265856" to "+8809654545";', NULL, NULL, '2025-10-10 15:02:33'),
	(9, 4, 'USER_UPDATED', 'user', 4, 'NHQ Admin', 'email from "naveadmin@gmail.com" to "nhqadmin@gmail.com"; ', NULL, NULL, '2025-10-10 15:02:37'),
	(10, 24, 'USER_UPDATED', 'user', 24, 'Captain John Smith', 'email from "john.smith@navy.mil" to "navy@gmail.com"; ', NULL, NULL, '2025-10-10 15:03:07'),
	(11, 24, 'USER_UPDATED', 'user', 24, 'User', 'name from "Captain John Smith" to "User"; ', NULL, NULL, '2025-10-10 15:03:36'),
	(12, 75, 'USER_UPDATED', 'user', 75, 'SO (Sig)1', 'name from "SO (Sig)" to "SO (Sig)1"; ', NULL, NULL, '2025-10-11 12:59:23'),
	(13, 92, 'USER_UPDATED', 'user', 92, 'ACNS (O)', 'name from "ACNS (O) 1" to "ACNS (O)"; ', NULL, NULL, '2025-10-11 13:00:56'),
	(14, 93, 'USER_UPDATED', 'user', 93, 'Coord to ACNS (O)', 'name from "Coord to ACNS (O) 1" to "Coord to ACNS (O)"; ', NULL, NULL, '2025-10-11 13:00:59');

-- Dumping structure for table cms_db.conversations
CREATE TABLE IF NOT EXISTS `conversations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` enum('direct','group') NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_type` (`type`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_created_by` (`created_by`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `conversations_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `conversations_ibfk_2` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.conversations: ~2 rows (approximately)
INSERT IGNORE INTO `conversations` (`id`, `type`, `name`, `organization_id`, `created_by`, `created_at`, `updated_at`) VALUES
	(1, 'direct', NULL, 1, 2, '2025-10-10 11:19:08', '2025-10-10 11:19:08'),
	(2, 'direct', NULL, 1, 2, '2025-10-10 11:19:08', '2025-10-10 11:19:08');

-- Dumping structure for table cms_db.conversation_participants
CREATE TABLE IF NOT EXISTS `conversation_participants` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `conversation_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `joined_at` timestamp NULL DEFAULT current_timestamp(),
  `last_read_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_participant` (`conversation_id`,`user_id`),
  KEY `idx_conversation_id` (`conversation_id`),
  KEY `idx_user_id` (`user_id`),
  CONSTRAINT `conversation_participants_ibfk_1` FOREIGN KEY (`conversation_id`) REFERENCES `conversations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `conversation_participants_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.conversation_participants: ~4 rows (approximately)
INSERT IGNORE INTO `conversation_participants` (`id`, `conversation_id`, `user_id`, `joined_at`, `last_read_at`) VALUES
	(1, 1, 2, '2025-10-10 11:19:08', NULL),
	(2, 1, 3, '2025-10-10 11:19:08', NULL),
	(3, 2, 2, '2025-10-10 11:19:08', NULL),
	(4, 2, 3, '2025-10-10 11:19:08', NULL);

-- Dumping structure for view cms_db.conversation_summary
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `conversation_summary` (
	`id` INT(11) NOT NULL,
	`type` ENUM('direct','group') NOT NULL COLLATE 'utf8mb4_general_ci',
	`name` VARCHAR(1) NULL COLLATE 'utf8mb4_general_ci',
	`participant_count` BIGINT(21) NOT NULL,
	`message_count` BIGINT(21) NOT NULL,
	`last_message_at` TIMESTAMP NULL,
	`created_at` TIMESTAMP NULL,
	`updated_at` TIMESTAMP NULL
);

-- Dumping structure for procedure cms_db.CreateDirectConversation
DELIMITER //
CREATE PROCEDURE `CreateDirectConversation`(
    IN p_user1_id INT,
    IN p_user2_id INT
)
BEGIN
    DECLARE v_conversation_id INT;
    DECLARE v_existing_conversation INT DEFAULT 0;

    -- Check if a conversation already exists between the two users
    SELECT COUNT(*) INTO v_existing_conversation
    FROM conversations c
    JOIN conversation_participants cp1 ON c.id = cp1.conversation_id
    JOIN conversation_participants cp2 ON c.id = cp2.conversation_id
    WHERE c.type = 'direct'
      AND ((cp1.user_id = p_user1_id AND cp2.user_id = p_user2_id)
        OR (cp1.user_id = p_user2_id AND cp2.user_id = p_user1_id));

    IF v_existing_conversation = 0 THEN
        -- Create a new direct conversation
        INSERT INTO conversations (type, created_by) VALUES ('direct', p_user1_id);
        SET v_conversation_id = LAST_INSERT_ID();

        -- Add both participants
        INSERT INTO conversation_participants (conversation_id, user_id)
        VALUES (v_conversation_id, p_user1_id),
               (v_conversation_id, p_user2_id);
    END IF;
END//
DELIMITER ;

-- Dumping structure for procedure cms_db.CreateUser
DELIMITER //
CREATE PROCEDURE `CreateUser`(
    IN p_name VARCHAR(255),
    IN p_rank_id INT,
    IN p_service_no VARCHAR(50),
    IN p_unit_id INT,
    IN p_department_id INT,
    IN p_role_id INT,
    IN p_designation_id INT,
    IN p_phone VARCHAR(20),
    IN p_mobile VARCHAR(20),
    IN p_alternative_mobile VARCHAR(20),
    IN p_email VARCHAR(255),
    IN p_password_hash VARCHAR(255)
)
BEGIN
    DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
        ROLLBACK;
        RESIGNAL;
    END;

    START TRANSACTION;

    INSERT INTO users (
        name, rank_id, service_no, unit_id, department_id,
        role_id, designation_id, phone, mobile, alternative_mobile, email, password_hash
    ) VALUES (
        p_name, p_rank_id, p_service_no, p_unit_id, p_department_id,
        p_role_id, p_designation_id, p_phone, p_mobile, p_alternative_mobile, p_email, p_password_hash
    );

    -- Log the user creation
    INSERT INTO audit_logs (user_id, action, target_type, target_name, details)
    VALUES (LAST_INSERT_ID(), 'USER_CREATED', 'user', p_name, 'User account created');

    COMMIT;
END//
DELIMITER ;

-- Dumping structure for table cms_db.departments
CREATE TABLE IF NOT EXISTS `departments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `parent_id` int(11) DEFAULT NULL,
  `order_id` int(11) DEFAULT 1,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL 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_name` (`name`),
  KEY `idx_is_active` (`is_active`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_parent_id` (`parent_id`),
  CONSTRAINT `departments_ibfk_2` FOREIGN KEY (`parent_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `departments_ibfk_3` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- NOTE: unit_id removed from departments; omit legacy seed data
	(22, 'CNS Sectt', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:48:55', '2025-10-11 04:48:55'),
	(23, 'NS', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:49:22', '2025-10-11 04:49:22'),
	(24, 'Drafting Authority', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:49:42', '2025-10-11 04:49:42'),
	(25, 'JAG', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:49:51', '2025-10-11 04:49:51'),
	(26, 'Operations', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:50:02', '2025-10-11 04:50:02'),
	(27, 'Personnel', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:50:14', '2025-10-11 04:50:14'),
	(28, 'Material', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:50:26', '2025-10-11 04:50:26'),
	(29, 'Logistics', 1, 1, NULL, 1, NULL, 1, '2025-10-11 04:50:46', '2025-10-11 04:50:46'),
	(30, 'ACNS', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:26:57', '2025-10-11 05:26:57'),
	(31, 'DNO', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:31:14', '2025-10-11 05:31:14'),
	(32, 'DNI', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:31:30', '2025-10-11 05:31:30'),
	(33, 'DNP', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:31:45', '2025-10-11 05:31:45'),
	(34, 'D SIG', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:32:02', '2025-10-11 05:32:02'),
	(35, 'D Works', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:32:15', '2025-10-11 05:32:15'),
	(36, 'Naval Avn', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:32:29', '2025-10-11 05:32:29'),
	(37, 'D Hydro', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:32:45', '2025-10-11 05:32:45'),
	(38, 'D Sub', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:32:56', '2025-10-11 05:32:56'),
	(39, 'D Spl Ops', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:34:01', '2025-10-11 05:34:01'),
	(40, 'SD & Cer', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:34:24', '2025-10-11 05:34:24'),
	(41, 'Overseas Op', 1, 1, 26, 1, NULL, 1, '2025-10-11 05:34:48', '2025-10-11 05:34:48'),
	(43, 'ACNS', 1, 1, 27, 1, NULL, 1, '2025-10-11 09:34:11', '2025-10-11 11:46:56'),
	(44, 'DPS', 1, 1, 27, 1, NULL, 1, '2025-10-11 09:36:05', '2025-10-11 09:36:05'),
	(45, 'DNT', 1, 1, 27, NULL, NULL, 1, '2025-10-11 09:58:41', '2025-10-11 09:58:41'),
	(46, 'D Wel', 1, 1, 27, NULL, NULL, 1, '2025-10-11 10:00:14', '2025-10-11 10:00:14'),
	(47, 'DMS', 1, 1, 27, NULL, NULL, 1, '2025-10-11 10:01:17', '2025-10-11 10:01:17'),
	(48, 'D Edn', 1, 1, 27, NULL, NULL, 1, '2025-10-11 10:04:50', '2025-10-11 10:04:50'),
	(49, 'D Civ Pres', 1, 1, 27, NULL, NULL, 1, '2025-10-11 10:06:14', '2025-10-11 10:06:14'),
	(51, 'ACNS', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:15:22', '2025-10-11 11:46:27'),
	(53, 'DNO', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:16:55', '2025-10-11 11:46:37'),
	(55, 'DNI', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:22:05', '2025-10-11 11:46:42'),
	(56, 'DNP', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:24:04', '2025-10-11 11:46:48'),
	(58, 'D SIG', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:56:12', '2025-10-11 11:47:02'),
	(59, 'D Works', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:57:31', '2025-10-11 11:47:06'),
	(60, 'Naval Avn', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:58:32', '2025-10-11 11:47:09'),
	(61, 'D Hydro', 1, 1, 28, NULL, NULL, 1, '2025-10-11 10:59:27', '2025-10-11 11:47:11'),
	(62, 'D Sub', 1, 1, 28, NULL, NULL, 1, '2025-10-11 11:00:31', '2025-10-11 11:47:14'),
	(63, 'D Spl Ops', 1, 1, 28, NULL, NULL, 1, '2025-10-11 11:01:59', '2025-10-11 11:47:17'),
	(64, 'SD & Cer', 1, 1, 28, NULL, NULL, 1, '2025-10-11 11:03:15', '2025-10-11 11:47:21'),
	(66, 'Overseas Op', 1, 1, 28, NULL, NULL, 1, '2025-10-11 11:04:21', '2025-10-11 11:47:24'),
	(68, 'ACNS', 1, 1, 29, NULL, NULL, 1, '2025-10-11 11:31:16', '2025-10-11 11:47:27'),
	(69, 'DNO', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:34:15', '2025-10-11 12:34:15'),
	(70, 'DNI', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:37:54', '2025-10-11 12:37:54'),
	(71, 'DNP', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:38:50', '2025-10-11 12:38:50'),
	(72, 'D SIG', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:39:07', '2025-10-11 12:39:07'),
	(73, 'D Works', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:39:35', '2025-10-11 12:39:35'),
	(74, 'Naval Avn', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:39:51', '2025-10-11 12:39:51'),
	(75, 'D Hydro', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:40:08', '2025-10-11 12:40:08'),
	(76, 'D Sub', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:40:30', '2025-10-11 12:40:30'),
	(77, 'D Spl Ops', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:40:55', '2025-10-11 12:40:55'),
	(78, 'SD & Cer', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:41:18', '2025-10-11 12:41:18'),
	(79, 'Overseas Op', 1, 1, 29, NULL, NULL, 1, '2025-10-11 12:41:43', '2025-10-11 12:41:43');

-- Dumping structure for table cms_db.designations
CREATE TABLE IF NOT EXISTS `designations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `department_id` int(11) NOT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `order_id` int(11) DEFAULT 1,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL 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 `name_department_parent` (`name`,`department_id`,`parent_id`),
  KEY `idx_name` (`name`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_department_id` (`department_id`),
  KEY `idx_parent_id` (`parent_id`),
  KEY `idx_is_active` (`is_active`),
  CONSTRAINT `designations_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`),
  CONSTRAINT `designations_ibfk_2` FOREIGN KEY (`parent_id`) REFERENCES `designations` (`id`) ON DELETE SET NULL,
  CONSTRAINT `designations_ibfk_3` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.designations: ~122 rows (approximately)
INSERT IGNORE INTO `designations` (`id`, `name`, `organization_id`, `department_id`, `parent_id`, `order_id`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
	(1, 'CNS', 1, 22, NULL, 1, NULL, 1, '2025-10-11 04:52:04', '2025-10-11 04:52:04'),
	(2, 'Secy to CNS', 1, 22, NULL, 1, NULL, 1, '2025-10-11 04:52:40', '2025-10-11 04:52:40'),
	(3, 'Asst Secy', 1, 22, NULL, 1, NULL, 1, '2025-10-11 04:53:09', '2025-10-11 04:53:09'),
	(4, 'Flag Lt', 1, 22, NULL, 1, NULL, 1, '2025-10-11 04:53:27', '2025-10-11 04:53:27'),
	(5, 'Protocol Offr', 1, 22, NULL, 1, NULL, 1, '2025-10-11 04:54:05', '2025-10-11 04:54:05'),
	(6, 'Escort Offr', 1, 22, NULL, 1, NULL, 1, '2025-10-11 04:54:24', '2025-10-11 04:54:24'),
	(7, 'NS', 1, 23, NULL, 1, NULL, 1, '2025-10-11 05:16:29', '2025-10-11 05:16:29'),
	(8, 'SONA-1', 1, 23, NULL, 1, NULL, 1, '2025-10-11 05:16:45', '2025-10-11 05:16:45'),
	(9, 'SONA-1 (Tec)', 1, 23, NULL, 1, NULL, 1, '2025-10-11 05:17:07', '2025-10-11 05:17:07'),
	(10, 'SONA-2', 1, 23, NULL, 1, NULL, 1, '2025-10-11 05:17:20', '2025-10-11 05:17:20'),
	(11, 'SONA-2 (Plans)', 1, 23, NULL, 1, NULL, 1, '2025-10-11 05:17:57', '2025-10-11 05:17:57'),
	(12, 'SO Tec', 1, 23, NULL, 1, NULL, 1, '2025-10-11 05:18:09', '2025-10-11 05:18:09'),
	(13, 'DA', 1, 24, NULL, 1, NULL, 1, '2025-10-11 05:18:35', '2025-10-11 05:18:35'),
	(14, 'DD Drafting', 1, 24, NULL, 1, NULL, 1, '2025-10-11 05:18:49', '2025-10-11 05:18:49'),
	(15, 'Sec Comd-1', 1, 24, NULL, 1, NULL, 1, '2025-10-11 05:19:11', '2025-10-11 05:19:11'),
	(16, 'Sec Comd-2', 1, 24, NULL, 1, NULL, 1, '2025-10-11 05:19:32', '2025-10-11 05:19:32'),
	(17, 'Sec Comd-3', 1, 24, NULL, 1, NULL, 1, '2025-10-11 05:19:59', '2025-10-11 05:19:59'),
	(18, 'JAG', 1, 25, NULL, 1, NULL, 1, '2025-10-11 05:23:40', '2025-10-11 05:23:40'),
	(19, 'DD JAG', 1, 25, NULL, 1, NULL, 1, '2025-10-11 05:23:54', '2025-10-11 05:23:54'),
	(20, 'SO (JAG)', 1, 25, NULL, 1, NULL, 1, '2025-10-11 05:24:08', '2025-10-11 05:24:08'),
	(21, 'ACNS (O)', 1, 30, NULL, 1, NULL, 1, '2025-10-11 05:27:42', '2025-10-11 05:27:42'),
	(22, 'Coord to ACNS (O)', 1, 30, NULL, 1, NULL, 1, '2025-10-11 05:30:00', '2025-10-11 05:30:00'),
	(23, 'DDNO', 1, 31, NULL, 1, NULL, 1, '2025-10-11 05:36:19', '2025-10-11 05:36:19'),
	(24, 'SO (O)', 1, 31, NULL, 1, NULL, 1, '2025-10-11 05:36:38', '2025-10-11 05:36:38'),
	(25, 'SO (Ops Plan)', 1, 31, NULL, 1, NULL, 1, '2025-10-11 05:37:08', '2025-10-11 05:37:08'),
	(26, 'DDNI', 1, 32, NULL, 1, NULL, 1, '2025-10-11 05:39:20', '2025-10-11 05:39:20'),
	(27, 'SO (l)', 1, 32, NULL, 1, NULL, 1, '2025-10-11 05:39:42', '2025-10-11 05:39:42'),
	(28, 'SO (Cl)', 1, 32, NULL, 1, NULL, 1, '2025-10-11 05:39:59', '2025-10-11 05:39:59'),
	(29, 'SO (Tec)', 1, 32, NULL, 1, NULL, 1, '2025-10-11 05:40:13', '2025-10-11 05:40:13'),
	(30, 'SO (Media)', 1, 32, NULL, 1, NULL, 1, '2025-10-11 05:40:31', '2025-10-11 05:40:31'),
	(31, 'DDNP', 1, 33, NULL, 1, NULL, 1, '2025-10-11 05:41:08', '2025-10-11 05:41:08'),
	(32, 'SO (Plan-1)', 1, 33, NULL, 1, NULL, 1, '2025-10-11 05:41:30', '2025-10-11 05:41:30'),
	(33, 'SO (Plans-2)', 1, 33, NULL, 1, NULL, 1, '2025-10-11 05:41:55', '2025-10-11 05:41:55'),
	(34, 'DD Sig', 1, 34, NULL, 1, NULL, 1, '2025-10-11 05:42:19', '2025-10-11 05:42:19'),
	(35, 'SO (Sig)', 1, 34, NULL, 1, NULL, 1, '2025-10-11 05:42:33', '2025-10-11 05:42:33'),
	(36, 'DD Works', 1, 35, NULL, 1, NULL, 1, '2025-10-11 05:43:06', '2025-10-11 05:43:06'),
	(37, 'SO (Works)', 1, 35, NULL, 1, NULL, 1, '2025-10-11 05:43:25', '2025-10-11 05:43:25'),
	(38, 'DD Nav', 1, 36, NULL, 1, NULL, 1, '2025-10-11 05:43:50', '2025-10-11 05:43:50'),
	(39, 'SO (Nav)', 1, 36, NULL, 1, NULL, 1, '2025-10-11 05:44:01', '2025-10-11 05:44:01'),
	(40, 'DD Hydro', 1, 37, NULL, 1, NULL, 1, '2025-10-11 05:45:04', '2025-10-11 05:45:04'),
	(41, 'SO (Hydro)', 1, 37, NULL, 1, NULL, 1, '2025-10-11 05:45:32', '2025-10-11 05:45:32'),
	(42, 'Capt Staff', 1, 38, NULL, 1, NULL, 1, '2025-10-11 05:46:28', '2025-10-11 05:46:28'),
	(43, 'DD Sub', 1, 38, NULL, 1, NULL, 1, '2025-10-11 05:46:37', '2025-10-11 05:46:37'),
	(44, 'DD Sub (Tec)', 1, 38, NULL, 1, NULL, 1, '2025-10-11 05:46:54', '2025-10-11 05:46:54'),
	(45, 'So (Sub)', 1, 38, NULL, 1, NULL, 1, '2025-10-11 05:47:17', '2025-10-11 05:47:17'),
	(46, 'DD Spl Ops', 1, 39, NULL, 1, NULL, 1, '2025-10-11 05:48:10', '2025-10-11 05:48:10'),
	(47, 'SO (Spl Ops)', 1, 39, NULL, 1, NULL, 1, '2025-10-11 05:48:44', '2025-10-11 05:48:44'),
	(48, 'DD SD & C', 1, 40, NULL, 1, NULL, 1, '2025-10-11 05:49:32', '2025-10-11 05:49:32'),
	(49, 'SO (SD & C)', 1, 40, NULL, 1, NULL, 1, '2025-10-11 05:49:48', '2025-10-11 05:49:48'),
	(50, 'DDONO', 1, 41, NULL, 1, NULL, 1, '2025-10-11 05:50:13', '2025-10-11 05:50:13'),
	(51, 'SO (ONO)', 1, 41, NULL, 1, NULL, 1, '2025-10-11 05:50:31', '2025-10-11 05:50:31'),
	(52, 'ACNS (O) 1', 1, 43, NULL, 1, NULL, 1, '2025-10-11 09:35:22', '2025-10-11 09:35:22'),
	(53, 'Coord to ACNS (O) 1', 1, 43, NULL, 1, NULL, 1, '2025-10-11 09:35:41', '2025-10-11 09:35:41'),
	(54, 'DDNPS', 1, 44, NULL, 1, NULL, 1, '2025-10-11 09:37:09', '2025-10-11 09:37:09'),
	(55, 'SO (Pers)', 1, 44, NULL, 1, NULL, 1, '2025-10-11 09:57:23', '2025-10-11 09:57:23'),
	(56, 'DDNT', 1, 45, NULL, 1, NULL, 1, '2025-10-11 09:59:06', '2025-10-11 09:59:06'),
	(57, 'SO (T-1)', 1, 45, NULL, 1, NULL, 1, '2025-10-11 09:59:27', '2025-10-11 09:59:27'),
	(58, 'SO (T-2)', 1, 45, NULL, 1, NULL, 1, '2025-10-11 09:59:47', '2025-10-11 09:59:47'),
	(59, 'SO', 1, 45, NULL, 1, NULL, 1, '2025-10-11 09:59:54', '2025-10-11 09:59:54'),
	(60, 'DD Wel', 1, 46, NULL, 1, NULL, 1, '2025-10-11 10:00:42', '2025-10-11 10:00:42'),
	(61, 'SO (Wel)', 1, 46, NULL, 1, NULL, 1, '2025-10-11 10:00:58', '2025-10-11 10:00:58'),
	(62, 'DDMS', 1, 47, NULL, 1, NULL, 1, '2025-10-11 10:04:14', '2025-10-11 10:04:14'),
	(63, 'SO', 1, 47, NULL, 1, NULL, 1, '2025-10-11 10:04:24', '2025-10-11 10:04:24'),
	(64, 'DD Edn', 1, 48, NULL, 1, NULL, 1, '2025-10-11 10:05:15', '2025-10-11 10:05:15'),
	(65, 'SO (Edn)', 1, 48, NULL, 1, NULL, 1, '2025-10-11 10:05:27', '2025-10-11 10:05:27'),
	(66, 'DD Nav', 1, 49, NULL, 1, NULL, 1, '2025-10-11 10:06:54', '2025-10-11 10:06:54'),
	(67, 'SO (Nav)', 1, 49, NULL, 1, NULL, 1, '2025-10-11 10:07:11', '2025-10-11 10:07:11'),
	(68, 'ACNS (O)', 1, 51, NULL, 1, NULL, 1, '2025-10-11 10:15:49', '2025-10-11 10:15:49'),
	(69, 'Coord to ACNS (O)', 1, 51, NULL, 1, NULL, 1, '2025-10-11 10:16:15', '2025-10-11 10:16:15'),
	(70, 'DDNO', 1, 53, NULL, 1, NULL, 1, '2025-10-11 10:20:49', '2025-10-11 10:20:49'),
	(71, 'SO (O)', 1, 53, NULL, 1, NULL, 1, '2025-10-11 10:21:05', '2025-10-11 10:21:05'),
	(72, 'SO (Ops Plan)', 1, 53, NULL, 1, NULL, 1, '2025-10-11 10:21:28', '2025-10-11 10:21:28'),
	(73, 'DDNI', 1, 55, NULL, 1, NULL, 1, '2025-10-11 10:22:24', '2025-10-11 10:22:24'),
	(74, 'SO (l)', 1, 55, NULL, 1, NULL, 1, '2025-10-11 10:22:43', '2025-10-11 10:22:43'),
	(75, 'SO (Cl)', 1, 55, NULL, 1, NULL, 1, '2025-10-11 10:22:59', '2025-10-11 10:22:59'),
	(76, 'SO (Tec)', 1, 55, NULL, 1, NULL, 1, '2025-10-11 10:23:11', '2025-10-11 10:23:11'),
	(77, 'SO (Media)', 1, 55, NULL, 1, NULL, 1, '2025-10-11 10:23:25', '2025-10-11 10:23:25'),
	(78, 'DDNP', 1, 56, NULL, 1, NULL, 1, '2025-10-11 10:24:21', '2025-10-11 10:24:21'),
	(79, 'SO (Plan-1)', 1, 56, NULL, 1, NULL, 1, '2025-10-11 10:24:42', '2025-10-11 10:24:42'),
	(80, 'SO (Plans-2)', 1, 56, NULL, 1, NULL, 1, '2025-10-11 10:24:59', '2025-10-11 10:24:59'),
	(81, 'DD Sig', 1, 58, NULL, 1, NULL, 1, '2025-10-11 10:56:52', '2025-10-11 10:56:52'),
	(82, 'SO (Sig)', 1, 58, NULL, 1, NULL, 1, '2025-10-11 10:57:09', '2025-10-11 10:57:09'),
	(83, 'DD Works', 1, 59, NULL, 1, NULL, 1, '2025-10-11 10:57:52', '2025-10-11 10:57:52'),
	(84, 'SO (Works)', 1, 59, NULL, 1, NULL, 1, '2025-10-11 10:58:10', '2025-10-11 10:58:10'),
	(85, 'DD Nav', 1, 60, NULL, 1, NULL, 1, '2025-10-11 10:58:55', '2025-10-11 10:58:55'),
	(86, 'SO (Nav)', 1, 60, NULL, 1, NULL, 1, '2025-10-11 10:59:08', '2025-10-11 10:59:08'),
	(87, 'DD Hydro', 1, 61, NULL, 1, NULL, 1, '2025-10-11 10:59:47', '2025-10-11 10:59:47'),
	(88, 'SO (Hydro)', 1, 61, NULL, 1, NULL, 1, '2025-10-11 11:00:02', '2025-10-11 11:00:02'),
	(89, 'Capt Staff', 1, 62, NULL, 1, NULL, 1, '2025-10-11 11:00:51', '2025-10-11 11:00:51'),
	(90, 'DD Sub', 1, 62, NULL, 1, NULL, 1, '2025-10-11 11:01:00', '2025-10-11 11:01:00'),
	(91, 'DD Sub (Tec)', 1, 62, NULL, 1, NULL, 1, '2025-10-11 11:01:19', '2025-10-11 11:01:19'),
	(92, 'So (Sub)', 1, 62, NULL, 1, NULL, 1, '2025-10-11 11:01:38', '2025-10-11 11:01:38'),
	(93, 'DD Spl Ops', 1, 63, NULL, 1, NULL, 1, '2025-10-11 11:02:28', '2025-10-11 11:02:28'),
	(94, 'SO (Spl Ops)', 1, 63, NULL, 1, NULL, 1, '2025-10-11 11:02:47', '2025-10-11 11:02:47'),
	(95, 'DD SD & C', 1, 64, NULL, 1, NULL, 1, '2025-10-11 11:03:35', '2025-10-11 11:03:35'),
	(96, 'SO (SD & C)', 1, 64, NULL, 1, NULL, 1, '2025-10-11 11:03:51', '2025-10-11 11:03:51'),
	(97, 'Overseas Op', 1, 66, NULL, 1, NULL, 1, '2025-10-11 11:04:38', '2025-10-11 11:04:38'),
	(98, 'ACNS (O)', 1, 68, NULL, 1, NULL, 1, '2025-10-11 12:14:46', '2025-10-11 12:14:46'),
	(99, 'Coord to ACNS (O)', 1, 68, NULL, 1, NULL, 1, '2025-10-11 12:24:18', '2025-10-11 12:24:18'),
	(100, 'DDNO', 1, 69, NULL, 1, NULL, 1, '2025-10-11 12:34:34', '2025-10-11 12:34:34'),
	(101, 'SO (O)', 1, 69, NULL, 1, NULL, 1, '2025-10-11 12:36:15', '2025-10-11 12:36:15'),
	(102, 'SO (Ops Plan)', 1, 69, NULL, 1, NULL, 1, '2025-10-11 12:36:43', '2025-10-11 12:36:43'),
	(103, 'DDNI', 1, 70, NULL, 1, NULL, 1, '2025-10-11 12:42:38', '2025-10-11 12:42:38'),
	(104, 'SO (I)', 1, 70, NULL, 1, NULL, 1, '2025-10-11 12:42:56', '2025-10-11 12:42:56'),
	(105, 'SO (Cl)', 1, 70, NULL, 1, NULL, 1, '2025-10-11 12:43:19', '2025-10-11 12:43:19'),
	(106, 'SO (Tec)', 1, 70, NULL, 1, NULL, 1, '2025-10-11 12:43:36', '2025-10-11 12:43:36'),
	(107, 'SO (Media)', 1, 70, NULL, 1, NULL, 1, '2025-10-11 12:43:54', '2025-10-11 12:43:54'),
	(108, 'DDNP', 1, 71, NULL, 1, NULL, 1, '2025-10-11 12:44:54', '2025-10-11 12:44:54'),
	(109, 'SO (Plan-1)', 1, 71, NULL, 1, NULL, 1, '2025-10-11 12:45:16', '2025-10-11 12:45:16'),
	(110, 'SO (Plans-2)', 1, 71, NULL, 1, NULL, 1, '2025-10-11 12:45:45', '2025-10-11 12:45:45'),
	(111, 'DD Sig', 1, 72, NULL, 1, NULL, 1, '2025-10-11 12:46:38', '2025-10-11 12:46:38'),
	(112, 'SO (Sig)', 1, 72, NULL, 1, NULL, 1, '2025-10-11 12:47:11', '2025-10-11 12:47:11'),
	(113, 'DD Works', 1, 73, NULL, 1, NULL, 1, '2025-10-11 12:47:52', '2025-10-11 12:47:52'),
	(114, 'SO (Works)', 1, 73, NULL, 1, NULL, 1, '2025-10-11 12:48:09', '2025-10-11 12:48:09'),
	(115, 'DD Nav', 1, 74, NULL, 1, NULL, 1, '2025-10-11 12:48:45', '2025-10-11 12:48:45'),
	(116, 'SO (Nav)', 1, 74, NULL, 1, NULL, 1, '2025-10-11 12:49:03', '2025-10-11 12:49:03'),
	(117, 'DD Hydro', 1, 75, NULL, 1, NULL, 1, '2025-10-11 12:49:38', '2025-10-11 12:49:38'),
	(118, 'SO (Hydro)', 1, 75, NULL, 1, NULL, 1, '2025-10-11 12:49:54', '2025-10-11 12:49:54'),
	(119, 'Capt Staff', 1, 76, NULL, 1, NULL, 1, '2025-10-11 12:50:32', '2025-10-11 12:50:32'),
	(120, 'DD Sub', 1, 76, NULL, 1, NULL, 1, '2025-10-11 12:50:43', '2025-10-11 12:50:43'),
	(121, 'DD Sub (Tec)', 1, 76, NULL, 1, NULL, 1, '2025-10-11 12:51:46', '2025-10-11 12:51:46'),
	(122, 'So (Sub)', 1, 76, NULL, 1, NULL, 1, '2025-10-11 12:52:08', '2025-10-11 12:52:08'),
	(123, 'DD Spl Ops', 1, 77, NULL, 1, NULL, 1, '2025-10-11 12:53:06', '2025-10-11 12:53:06'),
	(124, 'SO (Spl Ops)', 1, 77, NULL, 1, NULL, 1, '2025-10-11 12:53:34', '2025-10-11 12:53:34'),
	(125, 'DD SD & C', 1, 78, NULL, 1, NULL, 1, '2025-10-11 12:54:20', '2025-10-11 12:54:20'),
	(126, 'SO (SD & C)', 1, 78, NULL, 1, NULL, 1, '2025-10-11 12:54:48', '2025-10-11 12:54:48');

-- Dumping structure for table cms_db.feedback
CREATE TABLE IF NOT EXISTS `feedback` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `rating` int(11) NOT NULL,
  `category` varchar(100) NOT NULL,
  `subject` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `satisfaction` enum('Very Satisfied','Satisfied','Neutral','Dissatisfied','Very Dissatisfied') NOT NULL,
  `recommend` enum('Definitely','Probably','Not Sure','Probably Not','Definitely Not') NOT NULL,
  `improvements` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`improvements`)),
  `anonymous` tinyint(1) NOT NULL DEFAULT 0,
  `status` enum('pending','reviewed','resolved') NOT NULL DEFAULT 'pending',
  `reviewed_by` int(11) DEFAULT NULL,
  `reviewed_at` timestamp NULL DEFAULT NULL,
  `resolution_notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `reviewed_by` (`reviewed_by`),
  KEY `idx_email` (`email`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_rating` (`rating`),
  KEY `idx_category` (`category`),
  KEY `idx_status` (`status`),
  KEY `idx_anonymous` (`anonymous`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_feedback_status_created` (`status`,`created_at`),
  CONSTRAINT `feedback_ibfk_1` FOREIGN KEY (`reviewed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `feedback_ibfk_2` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`),
  CHECK (`rating` >= 1 and `rating` <= 5)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.feedback: ~0 rows (approximately)

-- Dumping structure for procedure cms_db.LogUserActivity
DELIMITER //
CREATE PROCEDURE `LogUserActivity`(
    IN p_user_id INT,
    IN p_action VARCHAR(100),
    IN p_target_type VARCHAR(100),
    IN p_target_id INT,
    IN p_target_name VARCHAR(255),
    IN p_details TEXT,
    IN p_ip_address VARCHAR(45),
    IN p_user_agent TEXT
)
BEGIN
    INSERT INTO audit_logs (
        user_id, action, target_type, target_id, target_name,
        details, ip_address, user_agent
    ) VALUES (
        p_user_id, p_action, p_target_type, p_target_id, p_target_name,
        p_details, p_ip_address, p_user_agent
    );
END//
DELIMITER ;

-- Dumping structure for table cms_db.messages
CREATE TABLE IF NOT EXISTS `messages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `conversation_id` int(11) NOT NULL,
  `sender_id` int(11) NOT NULL,
  `content` text NOT NULL,
  `type` enum('text','system') NOT NULL DEFAULT 'text',
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_conversation_id` (`conversation_id`),
  KEY `idx_sender_id` (`sender_id`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_is_read` (`is_read`),
  KEY `idx_messages_conversation_created` (`conversation_id`,`created_at`),
  CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`conversation_id`) REFERENCES `conversations` (`id`) ON DELETE CASCADE,
  CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.messages: ~0 rows (approximately)

-- Dumping structure for view cms_db.message_statistics
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `message_statistics` (
	`message_date` DATE NULL,
	`total_messages` BIGINT(21) NOT NULL,
	`text_messages` BIGINT(21) NOT NULL,
	`system_messages` BIGINT(21) NOT NULL,
	`unique_senders` BIGINT(21) NOT NULL
);

-- Dumping structure for table cms_db.notifications
CREATE TABLE IF NOT EXISTS `notifications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `type` enum('info','warning','error','success') NOT NULL DEFAULT 'info',
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `action_url` varchar(500) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `read_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_type` (`type`),
  KEY `idx_is_read` (`is_read`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `notifications_ibfk_2` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.notifications: ~0 rows (approximately)

-- Dumping structure for table cms_db.permissions
CREATE TABLE IF NOT EXISTS `permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `resource` varchar(100) NOT NULL,
  `action` varchar(50) NOT NULL,
  `is_active` tinyint(1) NOT NULL 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 `unique_permission` (`resource`,`action`),
  KEY `idx_name` (`name`),
  KEY `idx_resource` (`resource`),
  KEY `idx_action` (`action`),
  KEY `idx_is_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=149 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.permissions: ~145 rows (approximately)
INSERT IGNORE INTO `permissions` (`id`, `name`, `description`, `resource`, `action`, `is_active`, `created_at`, `updated_at`) VALUES
	(1, 'user.create', 'Create new users', 'user', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(2, 'user.read', 'View user information', 'user', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(3, 'user.update', 'Update user information', 'user', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(4, 'user.delete', 'Delete users', 'user', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(5, 'user.manage_roles', 'Manage user roles and permissions', 'user', 'manage_roles', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(6, 'user.export', 'Export user data', 'user', 'export', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(7, 'user.import', 'Import user data', 'user', 'import', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(8, 'unit.create', 'Create new units', 'unit', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(9, 'unit.read', 'View unit information', 'unit', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(10, 'unit.update', 'Update unit information', 'unit', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(11, 'unit.delete', 'Delete units', 'unit', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(12, 'department.create', 'Create new departments', 'department', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(13, 'department.read', 'View department information', 'department', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(14, 'department.update', 'Update department information', 'department', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(15, 'department.delete', 'Delete departments', 'department', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(16, 'designation.create', 'Create new designations', 'designation', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(17, 'designation.read', 'View designation information', 'designation', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(18, 'designation.update', 'Update designation information', 'designation', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(19, 'designation.delete', 'Delete designations', 'designation', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(20, 'rank.create', 'Create new ranks', 'rank', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(21, 'rank.read', 'View rank information', 'rank', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(22, 'rank.update', 'Update rank information', 'rank', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(23, 'rank.delete', 'Delete ranks', 'rank', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(24, 'contact.create', 'Create new contacts', 'contact', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(25, 'contact.read', 'View contact information', 'contact', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(26, 'contact.update', 'Update contact information', 'contact', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(27, 'contact.delete', 'Delete contacts', 'contact', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(28, 'contact.export', 'Export contact data', 'contact', 'export', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(29, 'contact.import', 'Import contact data', 'contact', 'import', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(30, 'message.create', 'Send messages', 'message', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(31, 'message.read', 'Read messages', 'message', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(32, 'message.update', 'Update messages', 'message', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(33, 'message.delete', 'Delete messages', 'message', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(34, 'message.broadcast', 'Send broadcast messages', 'message', 'broadcast', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(35, 'conversation.create', 'Create conversations', 'conversation', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(36, 'conversation.read', 'View conversations', 'conversation', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(37, 'conversation.update', 'Update conversations', 'conversation', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(38, 'conversation.delete', 'Delete conversations', 'conversation', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(39, 'conversation.manage', 'Manage conversation participants', 'conversation', 'manage', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(40, 'notification.create', 'Create notifications', 'notification', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(41, 'notification.read', 'View notifications', 'notification', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(42, 'notification.update', 'Update notifications', 'notification', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(43, 'notification.delete', 'Delete notifications', 'notification', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(44, 'notification.broadcast', 'Send broadcast notifications', 'notification', 'broadcast', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(45, 'feedback.create', 'Submit feedback', 'feedback', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(46, 'feedback.read', 'View feedback', 'feedback', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(47, 'feedback.update', 'Update feedback status', 'feedback', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(48, 'feedback.delete', 'Delete feedback', 'feedback', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(49, 'feedback.respond', 'Respond to feedback', 'feedback', 'respond', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(50, 'audit_log.read', 'View audit logs', 'audit_log', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(51, 'audit_log.delete', 'Delete audit logs', 'audit_log', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(52, 'audit_log.export', 'Export audit logs', 'audit_log', 'export', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(53, 'system_settings.read', 'View system settings', 'system_settings', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(54, 'system_settings.update', 'Update system settings', 'system_settings', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(55, 'system_settings.backup', 'Create system backups', 'system_settings', 'backup', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(56, 'system_settings.restore', 'Restore system from backup', 'system_settings', 'restore', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(57, 'dashboard.view', 'Access dashboard', 'dashboard', 'view', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(58, 'dashboard.analytics', 'View analytics and statistics', 'dashboard', 'analytics', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(59, 'dashboard.reports', 'Generate and view reports', 'dashboard', 'reports', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(60, 'dashboard.customize', 'Customize dashboard layout', 'dashboard', 'customize', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(61, 'file.upload', 'Upload files', 'file', 'upload', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(62, 'file.download', 'Download files', 'file', 'download', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(63, 'file.delete', 'Delete files', 'file', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(64, 'file.manage', 'Manage file permissions', 'file', 'manage', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(65, 'profile.read', 'View own profile', 'profile', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(66, 'profile.update', 'Update own profile', 'profile', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(67, 'profile.change_password', 'Change own password', 'profile', 'change_password', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(68, 'settings.access', 'Access settings page', 'settings', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(69, 'settings.profile', 'Manage profile settings', 'settings', 'profile', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(70, 'settings.security', 'Manage security settings', 'settings', 'security', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(71, 'settings.notifications', 'Manage notification settings', 'settings', 'notifications', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(72, 'settings.privacy', 'Manage privacy settings', 'settings', 'privacy', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(73, 'settings.preferences', 'Manage user preferences', 'settings', 'preferences', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(74, 'role.create', 'Create new roles', 'role', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(75, 'role.read', 'View roles', 'role', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(76, 'role.update', 'Update roles', 'role', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(77, 'role.delete', 'Delete roles', 'role', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(78, 'role.manage_permissions', 'Manage role permissions', 'role', 'manage_permissions', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(79, 'permission.create', 'Create new permissions', 'permission', 'create', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(80, 'permission.read', 'View permissions', 'permission', 'read', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(81, 'permission.update', 'Update permissions', 'permission', 'update', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(82, 'permission.delete', 'Delete permissions', 'permission', 'delete', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(83, 'admin.access', 'Access admin panel', 'admin', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 21:22:04'),
	(84, 'admin.dashboard', 'View admin dashboard', 'admin', 'dashboard', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(85, 'admin.analytics', 'View admin analytics', 'admin', 'analytics', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(86, 'directory.access', 'Access contact directory', 'directory', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(87, 'directory.search', 'Search in directory', 'directory', 'search', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(88, 'directory.filter', 'Filter directory results', 'directory', 'filter', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(89, 'directory.export', 'Export directory data', 'directory', 'export', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(90, 'conversations.access', 'Access conversations page', 'conversations', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(91, 'conversations.create_group', 'Create group conversations', 'conversations', 'create_group', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(92, 'conversations.manage_groups', 'Manage group conversations', 'conversations', 'manage_groups', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(93, 'individual_messaging.access', 'Access individual messaging', 'individual_messaging', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(94, 'individual_messaging.send', 'Send individual messages', 'individual_messaging', 'send', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(95, 'individual_messaging.broadcast', 'Send broadcast messages', 'individual_messaging', 'broadcast', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(96, 'feedback_form.access', 'Access feedback form', 'feedback_form', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(97, 'feedback_form.submit', 'Submit feedback', 'feedback_form', 'submit', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(98, 'feedback_form.view_responses', 'View feedback responses', 'feedback_form', 'view_responses', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(99, 'profile_page.access', 'Access profile page', 'profile_page', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(100, 'profile_page.edit', 'Edit profile information', 'profile_page', 'edit', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(101, 'profile_page.change_avatar', 'Change profile avatar', 'profile_page', 'change_avatar', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(102, 'role_management.access', 'Access role management page', 'role_management', 'access', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(103, 'role_management.assign_roles', 'Assign roles to users', 'role_management', 'assign_roles', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(104, 'role_management.view_hierarchy', 'View role hierarchy', 'role_management', 'view_hierarchy', 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(105, 'dashboard.export', 'Permission to export dashboard', 'dashboard', 'export', 1, '2025-10-09 18:18:50', '2025-10-09 18:18:50'),
	(106, 'dashboard.import', 'Permission to import dashboard', 'dashboard', 'import', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(107, 'dashboard.manage', 'Permission to manage dashboard', 'dashboard', 'manage', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(108, 'dashboard.admin', 'Permission to admin dashboard', 'dashboard', 'admin', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(109, 'dashboard.settings', 'Permission to settings dashboard', 'dashboard', 'settings', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(110, 'dashboard.users', 'Permission to users dashboard', 'dashboard', 'users', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(111, 'dashboard.roles', 'Permission to roles dashboard', 'dashboard', 'roles', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(112, 'dashboard.permissions', 'Permission to permissions dashboard', 'dashboard', 'permissions', 1, '2025-10-09 18:19:03', '2025-10-09 18:19:03'),
	(113, 'dashboard.widget.contacts', 'Permission to view contacts widget', 'dashboard', 'widget', 1, '2025-10-09 18:22:27', '2025-10-09 18:22:27'),
	(115, 'dashboard.sales', 'Permission to sales dashboard', 'dashboard', 'sales', 1, '2025-10-09 18:35:05', '2025-10-09 18:35:05'),
	(116, 'dashboard.orders', 'Permission to orders dashboard', 'dashboard', 'orders', 1, '2025-10-09 18:35:05', '2025-10-09 18:35:05'),
	(117, 'dashboard.revenue', 'Permission to revenue dashboard', 'dashboard', 'revenue', 1, '2025-10-09 18:35:05', '2025-10-09 18:35:05'),
	(118, 'dashboard.chart', 'Permission to chart dashboard', 'dashboard', 'chart', 1, '2025-10-09 18:35:05', '2025-10-09 18:35:05'),
	(121, 'dashboard.widget.conversations', 'Permission for dashboard.widget.conversations', 'dashboard', 'widget.conversations', 1, '2025-10-09 19:04:43', '2025-10-09 19:04:43'),
	(122, 'dashboard.widget.online', 'Permission for dashboard.widget.online', 'dashboard', 'widget.online', 1, '2025-10-09 19:04:43', '2025-10-09 19:04:43'),
	(123, 'dashboard.widget.messages', 'Permission for dashboard.widget.messages', 'dashboard', 'widget.messages', 1, '2025-10-09 19:04:43', '2025-10-09 19:04:43'),
	(124, 'dashboard.widget.security', 'Permission for dashboard.widget.security', 'dashboard', 'widget.security', 1, '2025-10-09 19:04:43', '2025-10-09 19:04:43'),
	(125, 'security.view', 'Permission for security.view', 'security', 'view', 1, '2025-10-09 19:04:43', '2025-10-09 19:04:43'),
	(126, 'contact.details.message', 'Permission to send messages to contact details', 'contact', 'details.message', 1, '2025-10-09 20:06:26', '2025-10-09 20:06:26'),
	(127, 'contact.details.call', 'Permission to call contact details', 'contact', 'details.call', 1, '2025-10-09 20:06:26', '2025-10-09 20:06:26'),
	(128, 'contact.details.sms', 'Permission to send SMS to contact details', 'contact', 'details.sms', 1, '2025-10-09 20:06:26', '2025-10-09 20:06:26'),
	(129, 'contact.details.edit', 'Permission to edit contact details', 'contact', 'details.edit', 1, '2025-10-09 20:06:26', '2025-10-09 20:06:26'),
	(130, 'contact.details.view', 'Permission to view contact details', 'contact', 'details.view', 1, '2025-10-09 20:06:26', '2025-10-09 20:06:26'),
	(131, 'dashboard.widget.system', 'Permission to view system health widget', 'dashboard', 'widget.system', 1, '2025-10-09 20:08:15', '2025-10-09 20:08:15'),
	(132, 'dashboard.read', 'Read dashboard data and statistics', 'dashboard', 'read', 1, '2025-10-09 20:47:31', '2025-10-09 20:47:31'),
	(133, 'dashboard.totalContacts', 'Dashboard Total Contacts', 'dashboard', 'access', 1, '2025-10-09 21:14:08', '2025-10-09 21:14:08'),
	(134, 'user.excel_upload', 'Contact Directory Excel Upload', 'contact', 'upload', 1, '2025-10-10 04:32:07', '2025-10-10 04:32:07'),
	(135, 'directory.unit_filter', 'Filter by unit in directory', 'directory', 'unit_filter', 1, '2025-10-10 04:47:51', '2025-10-10 04:47:51'),
	(136, 'directory.department_filter', 'Filter by department in directory', 'directory', 'department_filter', 1, '2025-10-10 04:47:51', '2025-10-10 04:47:51'),
	(137, 'directory.grid_view', 'View directory in grid format', 'directory', 'grid_view', 1, '2025-10-10 04:47:51', '2025-10-10 04:47:51'),
	(138, 'directory.tree_view', 'View directory in tree format', 'directory', 'tree_view', 1, '2025-10-10 04:47:51', '2025-10-10 04:47:51'),
	(139, 'contact.details.name', 'View contact name', 'contact', 'details_name', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(140, 'contact.details.designation', 'View contact designation', 'contact', 'details_designation', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(141, 'contact.details.department', 'View contact department', 'contact', 'details_department', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(142, 'contact.details.unit', 'View contact unit', 'contact', 'details_unit', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(143, 'contact.details.sub_department', 'View contact sub department', 'contact', 'details_sub_department', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(144, 'contact.details.sub_unit', 'View contact sub unit', 'contact', 'details_sub_unit', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(145, 'contact.details.phone', 'View contact phone', 'contact', 'details_phone', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(146, 'contact.details.mobile', 'View contact mobile', 'contact', 'details_mobile', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(147, 'contact.details.alternative_mobile', 'View contact alternative mobile', 'contact', 'details_alternative_mobile', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12'),
	(148, 'contact.details.email', 'View contact email', 'contact', 'details_email', 1, '2025-10-10 04:56:12', '2025-10-10 04:56:12');

-- Dumping structure for table cms_db.ranks
CREATE TABLE IF NOT EXISTS `ranks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `level` int(11) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL 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 `name` (`name`),
  KEY `idx_name` (`name`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_level` (`level`),
  KEY `idx_is_active` (`is_active`),
  CONSTRAINT `ranks_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.ranks: ~17 rows (approximately)
INSERT IGNORE INTO `ranks` (`id`, `name`, `organization_id`, `level`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
	(1, 'Admiral', 1, 1, 'Highest naval rank', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(2, 'Vice Admiral', 1, 2, 'Senior flag officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(3, 'Rear Admiral', 1, 3, 'Flag officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(4, 'Commodore', 1, 4, 'Senior captain', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(5, 'Captain', 1, 5, 'Ship commanding officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(6, 'Commander', 1, 6, 'Senior officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(7, 'Lieutenant Commander', 1, 7, 'Mid-level officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(8, 'Lieutenant', 1, 8, 'Junior officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(9, 'Sub Lieutenant', 1, 9, 'Entry-level officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(10, 'Acting Sub Lieutenant', 1, 10, 'Probationary officer', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(11, 'Warrant Officer', 1, 11, 'Senior enlisted', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(12, 'Chief Petty Officer', 1, 12, 'Senior enlisted', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(13, 'Petty Officer', 1, 13, 'Mid-level enlisted', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(14, 'Leading Seaman', 1, 14, 'Junior enlisted', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(15, 'Able Seaman', 1, 15, 'Basic enlisted', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(16, 'Ordinary Seaman', 1, 16, 'Entry-level enlisted', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11'),
	(17, 'Major', 1, 6, 'Army equivalent rank', 1, '2025-10-10 11:40:11', '2025-10-10 11:40:11');

-- Dumping structure for table cms_db.roles
CREATE TABLE IF NOT EXISTS `roles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `description` text DEFAULT NULL,
  `level` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL 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 `name` (`name`),
  KEY `idx_name` (`name`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_level` (`level`),
  KEY `idx_is_active` (`is_active`),
  CONSTRAINT `roles_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.roles: ~6 rows (approximately)
INSERT IGNORE INTO `roles` (`id`, `name`, `organization_id`, `description`, `level`, `is_active`, `created_at`, `updated_at`) VALUES
	(1, 'Super Admin', 1, 'Super Administrator with full system access and control', 100, 1, '2025-10-09 17:22:14', '2025-10-10 05:20:18'),
	(2, 'Admin', 1, 'Administrator with elevated privileges and management access', 50, 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(3, 'User', 1, 'Manager with departmental oversight and user management', 30, 1, '2025-10-09 17:22:14', '2025-10-11 13:25:14'),
	(4, 'Officer', 1, 'Officer with operational access and reporting capabilities', 20, 1, '2025-10-09 17:22:14', '2025-10-09 17:22:14'),
	(5, 'Manager', 1, 'Regular user with standard access and basic permissions', 10, 1, '2025-10-09 17:22:14', '2025-10-10 15:04:40'),
	(6, 'Navy_admin', 1, 'Navy Admin', 50, 1, '2025-10-09 19:45:56', '2025-10-12 04:37:41');

-- Dumping structure for table cms_db.role_permissions
CREATE TABLE IF NOT EXISTS `role_permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role_id` int(11) NOT NULL,
  `permission_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_role_permission` (`role_id`,`permission_id`),
  KEY `idx_role_id` (`role_id`),
  KEY `idx_permission_id` (`permission_id`),
  CONSTRAINT `role_permissions_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_permissions_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2636 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.role_permissions: ~392 rows (approximately)
INSERT IGNORE INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES
	(105, 2, 1, '2025-10-09 17:22:14'),
	(106, 2, 2, '2025-10-09 17:22:14'),
	(107, 2, 3, '2025-10-09 17:22:14'),
	(108, 2, 6, '2025-10-09 17:22:14'),
	(109, 2, 7, '2025-10-09 17:22:14'),
	(110, 2, 8, '2025-10-09 17:22:14'),
	(111, 2, 9, '2025-10-09 17:22:14'),
	(112, 2, 10, '2025-10-09 17:22:14'),
	(113, 2, 11, '2025-10-09 17:22:14'),
	(114, 2, 12, '2025-10-09 17:22:14'),
	(115, 2, 13, '2025-10-09 17:22:14'),
	(116, 2, 14, '2025-10-09 17:22:14'),
	(117, 2, 15, '2025-10-09 17:22:14'),
	(118, 2, 16, '2025-10-09 17:22:14'),
	(119, 2, 17, '2025-10-09 17:22:14'),
	(120, 2, 18, '2025-10-09 17:22:14'),
	(121, 2, 19, '2025-10-09 17:22:14'),
	(122, 2, 20, '2025-10-09 17:22:14'),
	(123, 2, 21, '2025-10-09 17:22:14'),
	(124, 2, 22, '2025-10-09 17:22:14'),
	(125, 2, 23, '2025-10-09 17:22:14'),
	(126, 2, 24, '2025-10-09 17:22:14'),
	(127, 2, 25, '2025-10-09 17:22:14'),
	(128, 2, 26, '2025-10-09 17:22:14'),
	(129, 2, 27, '2025-10-09 17:22:14'),
	(130, 2, 28, '2025-10-09 17:22:14'),
	(131, 2, 29, '2025-10-09 17:22:14'),
	(132, 2, 30, '2025-10-09 17:22:14'),
	(133, 2, 31, '2025-10-09 17:22:14'),
	(134, 2, 32, '2025-10-09 17:22:14'),
	(135, 2, 33, '2025-10-09 17:22:14'),
	(136, 2, 34, '2025-10-09 17:22:14'),
	(137, 2, 35, '2025-10-09 17:22:14'),
	(138, 2, 36, '2025-10-09 17:22:14'),
	(139, 2, 37, '2025-10-09 17:22:14'),
	(140, 2, 38, '2025-10-09 17:22:14'),
	(141, 2, 39, '2025-10-09 17:22:14'),
	(142, 2, 40, '2025-10-09 17:22:14'),
	(143, 2, 41, '2025-10-09 17:22:14'),
	(144, 2, 42, '2025-10-09 17:22:14'),
	(145, 2, 43, '2025-10-09 17:22:14'),
	(146, 2, 44, '2025-10-09 17:22:14'),
	(147, 2, 45, '2025-10-09 17:22:14'),
	(148, 2, 46, '2025-10-09 17:22:14'),
	(149, 2, 47, '2025-10-09 17:22:14'),
	(150, 2, 48, '2025-10-09 17:22:14'),
	(151, 2, 49, '2025-10-09 17:22:14'),
	(152, 2, 50, '2025-10-09 17:22:14'),
	(153, 2, 52, '2025-10-09 17:22:14'),
	(154, 2, 53, '2025-10-09 17:22:14'),
	(155, 2, 57, '2025-10-09 17:22:14'),
	(156, 2, 58, '2025-10-09 17:22:14'),
	(157, 2, 59, '2025-10-09 17:22:14'),
	(158, 2, 60, '2025-10-09 17:22:14'),
	(159, 2, 61, '2025-10-09 17:22:14'),
	(160, 2, 62, '2025-10-09 17:22:14'),
	(161, 2, 63, '2025-10-09 17:22:14'),
	(162, 2, 64, '2025-10-09 17:22:14'),
	(163, 2, 65, '2025-10-09 17:22:14'),
	(164, 2, 66, '2025-10-09 17:22:14'),
	(165, 2, 67, '2025-10-09 17:22:14'),
	(166, 2, 68, '2025-10-09 17:22:14'),
	(167, 2, 69, '2025-10-09 17:22:14'),
	(168, 2, 70, '2025-10-09 17:22:14'),
	(169, 2, 71, '2025-10-09 17:22:14'),
	(170, 2, 72, '2025-10-09 17:22:14'),
	(171, 2, 73, '2025-10-09 17:22:14'),
	(172, 2, 75, '2025-10-09 17:22:14'),
	(173, 2, 76, '2025-10-09 17:22:14'),
	(174, 2, 78, '2025-10-09 17:22:14'),
	(175, 2, 80, '2025-10-09 17:22:14'),
	(176, 2, 81, '2025-10-09 17:22:14'),
	(177, 2, 83, '2025-10-09 17:22:14'),
	(178, 2, 84, '2025-10-09 17:22:14'),
	(179, 2, 85, '2025-10-09 17:22:14'),
	(180, 2, 86, '2025-10-09 17:22:14'),
	(181, 2, 87, '2025-10-09 17:22:14'),
	(182, 2, 88, '2025-10-09 17:22:14'),
	(183, 2, 89, '2025-10-09 17:22:14'),
	(184, 2, 90, '2025-10-09 17:22:14'),
	(185, 2, 91, '2025-10-09 17:22:14'),
	(186, 2, 92, '2025-10-09 17:22:14'),
	(187, 2, 93, '2025-10-09 17:22:14'),
	(188, 2, 94, '2025-10-09 17:22:14'),
	(189, 2, 95, '2025-10-09 17:22:14'),
	(190, 2, 96, '2025-10-09 17:22:14'),
	(191, 2, 97, '2025-10-09 17:22:14'),
	(192, 2, 98, '2025-10-09 17:22:14'),
	(193, 2, 99, '2025-10-09 17:22:14'),
	(194, 2, 100, '2025-10-09 17:22:14'),
	(195, 2, 101, '2025-10-09 17:22:14'),
	(196, 2, 102, '2025-10-09 17:22:14'),
	(197, 2, 103, '2025-10-09 17:22:14'),
	(198, 2, 104, '2025-10-09 17:22:14'),
	(268, 4, 2, '2025-10-09 17:22:14'),
	(269, 4, 9, '2025-10-09 17:22:14'),
	(270, 4, 13, '2025-10-09 17:22:14'),
	(271, 4, 17, '2025-10-09 17:22:14'),
	(272, 4, 21, '2025-10-09 17:22:14'),
	(273, 4, 25, '2025-10-09 17:22:14'),
	(274, 4, 26, '2025-10-09 17:22:14'),
	(275, 4, 30, '2025-10-09 17:22:14'),
	(276, 4, 31, '2025-10-09 17:22:14'),
	(277, 4, 32, '2025-10-09 17:22:14'),
	(278, 4, 33, '2025-10-09 17:22:14'),
	(279, 4, 35, '2025-10-09 17:22:14'),
	(280, 4, 36, '2025-10-09 17:22:14'),
	(281, 4, 37, '2025-10-09 17:22:14'),
	(282, 4, 41, '2025-10-09 17:22:14'),
	(283, 4, 42, '2025-10-09 17:22:14'),
	(284, 4, 45, '2025-10-09 17:22:14'),
	(285, 4, 46, '2025-10-09 17:22:14'),
	(286, 4, 47, '2025-10-09 17:22:14'),
	(287, 4, 57, '2025-10-09 17:22:14'),
	(288, 4, 58, '2025-10-09 17:22:14'),
	(289, 4, 61, '2025-10-09 17:22:14'),
	(290, 4, 62, '2025-10-09 17:22:14'),
	(291, 4, 65, '2025-10-09 17:22:14'),
	(292, 4, 66, '2025-10-09 17:22:14'),
	(293, 4, 67, '2025-10-09 17:22:14'),
	(294, 4, 68, '2025-10-09 17:22:14'),
	(295, 4, 69, '2025-10-09 17:22:14'),
	(296, 4, 70, '2025-10-09 17:22:14'),
	(297, 4, 71, '2025-10-09 17:22:14'),
	(298, 4, 72, '2025-10-09 17:22:14'),
	(299, 4, 73, '2025-10-09 17:22:14'),
	(300, 4, 86, '2025-10-09 17:22:14'),
	(301, 4, 87, '2025-10-09 17:22:14'),
	(302, 4, 88, '2025-10-09 17:22:14'),
	(303, 4, 90, '2025-10-09 17:22:14'),
	(304, 4, 91, '2025-10-09 17:22:14'),
	(305, 4, 93, '2025-10-09 17:22:14'),
	(306, 4, 94, '2025-10-09 17:22:14'),
	(307, 4, 96, '2025-10-09 17:22:14'),
	(308, 4, 97, '2025-10-09 17:22:14'),
	(309, 4, 99, '2025-10-09 17:22:14'),
	(310, 4, 100, '2025-10-09 17:22:14'),
	(311, 4, 101, '2025-10-09 17:22:14'),
	(312, 5, 2, '2025-10-09 17:22:14'),
	(313, 5, 9, '2025-10-09 17:22:14'),
	(314, 5, 13, '2025-10-09 17:22:14'),
	(315, 5, 17, '2025-10-09 17:22:14'),
	(316, 5, 21, '2025-10-09 17:22:14'),
	(317, 5, 25, '2025-10-09 17:22:14'),
	(318, 5, 30, '2025-10-09 17:22:14'),
	(319, 5, 31, '2025-10-09 17:22:14'),
	(320, 5, 32, '2025-10-09 17:22:14'),
	(321, 5, 33, '2025-10-09 17:22:14'),
	(322, 5, 35, '2025-10-09 17:22:14'),
	(323, 5, 36, '2025-10-09 17:22:14'),
	(324, 5, 37, '2025-10-09 17:22:14'),
	(325, 5, 41, '2025-10-09 17:22:14'),
	(326, 5, 42, '2025-10-09 17:22:14'),
	(327, 5, 45, '2025-10-09 17:22:14'),
	(328, 5, 46, '2025-10-09 17:22:14'),
	(329, 5, 57, '2025-10-09 17:22:15'),
	(330, 5, 61, '2025-10-09 17:22:15'),
	(331, 5, 62, '2025-10-09 17:22:15'),
	(332, 5, 65, '2025-10-09 17:22:15'),
	(333, 5, 66, '2025-10-09 17:22:15'),
	(334, 5, 67, '2025-10-09 17:22:15'),
	(335, 5, 68, '2025-10-09 17:22:15'),
	(336, 5, 69, '2025-10-09 17:22:15'),
	(337, 5, 70, '2025-10-09 17:22:15'),
	(338, 5, 71, '2025-10-09 17:22:15'),
	(339, 5, 72, '2025-10-09 17:22:15'),
	(340, 5, 73, '2025-10-09 17:22:15'),
	(341, 5, 86, '2025-10-09 17:22:15'),
	(342, 5, 87, '2025-10-09 17:22:15'),
	(343, 5, 90, '2025-10-09 17:22:15'),
	(344, 5, 93, '2025-10-09 17:22:15'),
	(345, 5, 94, '2025-10-09 17:22:15'),
	(346, 5, 96, '2025-10-09 17:22:15'),
	(347, 5, 97, '2025-10-09 17:22:15'),
	(348, 5, 99, '2025-10-09 17:22:15'),
	(349, 5, 100, '2025-10-09 17:22:15'),
	(350, 5, 101, '2025-10-09 17:22:15'),
	(364, 2, 110, '2025-10-09 18:35:05'),
	(365, 2, 115, '2025-10-09 18:35:05'),
	(366, 2, 116, '2025-10-09 18:35:05'),
	(367, 2, 117, '2025-10-09 18:35:05'),
	(368, 2, 118, '2025-10-09 18:35:05'),
	(2224, 1, 1, '2025-10-10 05:20:18'),
	(2225, 1, 2, '2025-10-10 05:20:18'),
	(2226, 1, 3, '2025-10-10 05:20:18'),
	(2227, 1, 4, '2025-10-10 05:20:18'),
	(2228, 1, 5, '2025-10-10 05:20:18'),
	(2229, 1, 6, '2025-10-10 05:20:18'),
	(2230, 1, 7, '2025-10-10 05:20:18'),
	(2231, 1, 8, '2025-10-10 05:20:18'),
	(2232, 1, 9, '2025-10-10 05:20:18'),
	(2233, 1, 10, '2025-10-10 05:20:18'),
	(2234, 1, 11, '2025-10-10 05:20:18'),
	(2235, 1, 12, '2025-10-10 05:20:18'),
	(2236, 1, 13, '2025-10-10 05:20:18'),
	(2237, 1, 14, '2025-10-10 05:20:18'),
	(2238, 1, 15, '2025-10-10 05:20:18'),
	(2239, 1, 16, '2025-10-10 05:20:18'),
	(2240, 1, 17, '2025-10-10 05:20:18'),
	(2241, 1, 18, '2025-10-10 05:20:18'),
	(2242, 1, 19, '2025-10-10 05:20:18'),
	(2243, 1, 20, '2025-10-10 05:20:18'),
	(2244, 1, 21, '2025-10-10 05:20:18'),
	(2245, 1, 22, '2025-10-10 05:20:18'),
	(2246, 1, 23, '2025-10-10 05:20:18'),
	(2247, 1, 24, '2025-10-10 05:20:18'),
	(2248, 1, 25, '2025-10-10 05:20:18'),
	(2249, 1, 26, '2025-10-10 05:20:18'),
	(2250, 1, 27, '2025-10-10 05:20:18'),
	(2251, 1, 28, '2025-10-10 05:20:18'),
	(2252, 1, 29, '2025-10-10 05:20:18'),
	(2253, 1, 30, '2025-10-10 05:20:18'),
	(2254, 1, 31, '2025-10-10 05:20:18'),
	(2255, 1, 32, '2025-10-10 05:20:18'),
	(2256, 1, 33, '2025-10-10 05:20:18'),
	(2257, 1, 34, '2025-10-10 05:20:18'),
	(2258, 1, 35, '2025-10-10 05:20:18'),
	(2259, 1, 36, '2025-10-10 05:20:18'),
	(2260, 1, 37, '2025-10-10 05:20:18'),
	(2261, 1, 38, '2025-10-10 05:20:18'),
	(2262, 1, 39, '2025-10-10 05:20:18'),
	(2263, 1, 40, '2025-10-10 05:20:18'),
	(2264, 1, 41, '2025-10-10 05:20:18'),
	(2265, 1, 42, '2025-10-10 05:20:18'),
	(2266, 1, 43, '2025-10-10 05:20:18'),
	(2267, 1, 44, '2025-10-10 05:20:18'),
	(2268, 1, 45, '2025-10-10 05:20:18'),
	(2269, 1, 46, '2025-10-10 05:20:18'),
	(2270, 1, 47, '2025-10-10 05:20:18'),
	(2271, 1, 48, '2025-10-10 05:20:18'),
	(2272, 1, 49, '2025-10-10 05:20:18'),
	(2273, 1, 50, '2025-10-10 05:20:18'),
	(2274, 1, 51, '2025-10-10 05:20:18'),
	(2275, 1, 52, '2025-10-10 05:20:18'),
	(2276, 1, 53, '2025-10-10 05:20:18'),
	(2277, 1, 54, '2025-10-10 05:20:18'),
	(2278, 1, 55, '2025-10-10 05:20:18'),
	(2279, 1, 56, '2025-10-10 05:20:18'),
	(2280, 1, 57, '2025-10-10 05:20:18'),
	(2281, 1, 58, '2025-10-10 05:20:18'),
	(2282, 1, 59, '2025-10-10 05:20:18'),
	(2283, 1, 60, '2025-10-10 05:20:18'),
	(2284, 1, 61, '2025-10-10 05:20:18'),
	(2285, 1, 62, '2025-10-10 05:20:18'),
	(2286, 1, 63, '2025-10-10 05:20:18'),
	(2287, 1, 83, '2025-10-10 05:20:18'),
	(2288, 1, 85, '2025-10-10 05:20:18'),
	(2289, 1, 84, '2025-10-10 05:20:18'),
	(2348, 1, 74, '2025-10-10 06:19:03'),
	(2349, 1, 76, '2025-10-10 06:19:03'),
	(2350, 1, 77, '2025-10-10 06:19:03'),
	(2351, 1, 75, '2025-10-10 06:19:03'),
	(2536, 3, 24, '2025-10-11 13:25:14'),
	(2537, 3, 25, '2025-10-11 13:25:15'),
	(2538, 3, 65, '2025-10-11 13:25:15'),
	(2539, 3, 66, '2025-10-11 13:25:15'),
	(2540, 3, 67, '2025-10-11 13:25:15'),
	(2541, 3, 86, '2025-10-11 13:25:15'),
	(2542, 3, 87, '2025-10-11 13:25:15'),
	(2543, 3, 88, '2025-10-11 13:25:15'),
	(2544, 3, 89, '2025-10-11 13:25:15'),
	(2545, 3, 99, '2025-10-11 13:25:15'),
	(2546, 3, 100, '2025-10-11 13:25:15'),
	(2547, 3, 101, '2025-10-11 13:25:15'),
	(2548, 3, 130, '2025-10-11 13:25:15'),
	(2549, 3, 135, '2025-10-11 13:25:15'),
	(2550, 3, 136, '2025-10-11 13:25:15'),
	(2551, 3, 137, '2025-10-11 13:25:15'),
	(2552, 3, 138, '2025-10-11 13:25:15'),
	(2553, 3, 139, '2025-10-11 13:25:15'),
	(2554, 3, 140, '2025-10-11 13:25:15'),
	(2555, 3, 141, '2025-10-11 13:25:15'),
	(2556, 3, 142, '2025-10-11 13:25:15'),
	(2557, 3, 143, '2025-10-11 13:25:15'),
	(2558, 3, 144, '2025-10-11 13:25:15'),
	(2559, 3, 145, '2025-10-11 13:25:15'),
	(2560, 3, 146, '2025-10-11 13:25:15'),
	(2561, 3, 147, '2025-10-11 13:25:15'),
	(2562, 3, 148, '2025-10-11 13:25:15'),
	(2563, 3, 9, '2025-10-11 13:25:15'),
	(2564, 6, 1, '2025-10-12 04:37:41'),
	(2565, 6, 2, '2025-10-12 04:37:41'),
	(2566, 6, 3, '2025-10-12 04:37:41'),
	(2567, 6, 4, '2025-10-12 04:37:41'),
	(2568, 6, 5, '2025-10-12 04:37:41'),
	(2569, 6, 6, '2025-10-12 04:37:41'),
	(2570, 6, 7, '2025-10-12 04:37:41'),
	(2571, 6, 8, '2025-10-12 04:37:41'),
	(2572, 6, 9, '2025-10-12 04:37:41'),
	(2573, 6, 10, '2025-10-12 04:37:41'),
	(2574, 6, 11, '2025-10-12 04:37:41'),
	(2575, 6, 12, '2025-10-12 04:37:41'),
	(2576, 6, 13, '2025-10-12 04:37:41'),
	(2577, 6, 14, '2025-10-12 04:37:41'),
	(2578, 6, 15, '2025-10-12 04:37:41'),
	(2579, 6, 16, '2025-10-12 04:37:41'),
	(2580, 6, 17, '2025-10-12 04:37:41'),
	(2581, 6, 18, '2025-10-12 04:37:41'),
	(2582, 6, 19, '2025-10-12 04:37:41'),
	(2583, 6, 20, '2025-10-12 04:37:41'),
	(2584, 6, 21, '2025-10-12 04:37:41'),
	(2585, 6, 22, '2025-10-12 04:37:41'),
	(2586, 6, 23, '2025-10-12 04:37:41'),
	(2587, 6, 24, '2025-10-12 04:37:41'),
	(2588, 6, 25, '2025-10-12 04:37:41'),
	(2589, 6, 26, '2025-10-12 04:37:41'),
	(2590, 6, 27, '2025-10-12 04:37:41'),
	(2591, 6, 28, '2025-10-12 04:37:41'),
	(2592, 6, 29, '2025-10-12 04:37:41'),
	(2593, 6, 50, '2025-10-12 04:37:41'),
	(2594, 6, 51, '2025-10-12 04:37:41'),
	(2595, 6, 52, '2025-10-12 04:37:41'),
	(2596, 6, 57, '2025-10-12 04:37:41'),
	(2597, 6, 61, '2025-10-12 04:37:41'),
	(2598, 6, 62, '2025-10-12 04:37:41'),
	(2599, 6, 63, '2025-10-12 04:37:41'),
	(2600, 6, 64, '2025-10-12 04:37:41'),
	(2601, 6, 65, '2025-10-12 04:37:41'),
	(2602, 6, 66, '2025-10-12 04:37:41'),
	(2603, 6, 67, '2025-10-12 04:37:41'),
	(2604, 6, 83, '2025-10-12 04:37:41'),
	(2605, 6, 84, '2025-10-12 04:37:41'),
	(2606, 6, 85, '2025-10-12 04:37:41'),
	(2607, 6, 86, '2025-10-12 04:37:41'),
	(2608, 6, 87, '2025-10-12 04:37:41'),
	(2609, 6, 88, '2025-10-12 04:37:41'),
	(2610, 6, 89, '2025-10-12 04:37:41'),
	(2611, 6, 99, '2025-10-12 04:37:41'),
	(2612, 6, 100, '2025-10-12 04:37:41'),
	(2613, 6, 101, '2025-10-12 04:37:41'),
	(2614, 6, 113, '2025-10-12 04:37:41'),
	(2615, 6, 121, '2025-10-12 04:37:41'),
	(2616, 6, 123, '2025-10-12 04:37:41'),
	(2617, 6, 129, '2025-10-12 04:37:41'),
	(2618, 6, 130, '2025-10-12 04:37:41'),
	(2619, 6, 131, '2025-10-12 04:37:41'),
	(2620, 6, 132, '2025-10-12 04:37:41'),
	(2621, 6, 135, '2025-10-12 04:37:41'),
	(2622, 6, 136, '2025-10-12 04:37:41'),
	(2623, 6, 137, '2025-10-12 04:37:41'),
	(2624, 6, 138, '2025-10-12 04:37:41'),
	(2625, 6, 139, '2025-10-12 04:37:41'),
	(2626, 6, 140, '2025-10-12 04:37:41'),
	(2627, 6, 141, '2025-10-12 04:37:41'),
	(2628, 6, 142, '2025-10-12 04:37:41'),
	(2629, 6, 143, '2025-10-12 04:37:41'),
	(2630, 6, 144, '2025-10-12 04:37:41'),
	(2631, 6, 145, '2025-10-12 04:37:41'),
	(2632, 6, 146, '2025-10-12 04:37:41'),
	(2633, 6, 147, '2025-10-12 04:37:41'),
	(2634, 6, 148, '2025-10-12 04:37:41'),
	(2635, 6, 133, '2025-10-12 04:37:41');

-- Dumping structure for table cms_db.system_settings
CREATE TABLE IF NOT EXISTS `system_settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(100) NOT NULL,
  `setting_value` text DEFAULT NULL,
  `setting_type` enum('string','number','boolean','json') NOT NULL DEFAULT 'string',
  `description` text DEFAULT NULL,
  `is_public` tinyint(1) NOT NULL DEFAULT 0,
  `updated_by` int(11) DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `setting_key` (`setting_key`),
  KEY `updated_by` (`updated_by`),
  KEY `idx_setting_key` (`setting_key`),
  KEY `idx_is_public` (`is_public`),
  CONSTRAINT `system_settings_ibfk_1` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.system_settings: ~0 rows (approximately)

-- ========================================================================
-- MULTI-ORGANIZATION SUPPORT
-- ========================================================================
-- This database supports multiple organizations. The 'organizations' table
-- is the root table for organizational hierarchy. The following tables have
-- organization_id foreign keys to support multi-organization data isolation:
--   - organizations (root table)
--   - units (organizational units per organization)
--   - departments (departments per organization)
--   - designations (designations per organization)
--   - ranks (military ranks per organization)
--   - roles (user roles per organization)
--   - users (users belong to an organization)
--   - conversations (messaging conversations per organization)
--   - notifications (user notifications per organization)
--   - feedback (user feedback per organization)
--   - audit_logs (activity logs per organization)
-- 
-- All organization_id fields have a DEFAULT value of 1 (Bangladesh Navy)
-- 
-- Organizational Hierarchy:
--   Organizations → Units → Departments → Designations → Users
--   Organizations → Ranks
--   Organizations → Roles → Users
-- ========================================================================

-- Dumping structure for table cms_db.organizations
CREATE TABLE IF NOT EXISTS `organizations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `code` varchar(50) NOT NULL,
  `type` varchar(100) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `address` text DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `logo` varchar(500) DEFAULT NULL,
  `theme` varchar(500) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(11) 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 `code` (`code`),
  KEY `idx_name` (`name`),
  KEY `idx_code` (`code`),
  KEY `idx_is_active` (`is_active`),
  KEY `idx_created_by` (`created_by`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.organizations: ~1 row (approximately)
INSERT IGNORE INTO `organizations` (`id`, `name`, `code`, `type`, `description`, `address`, `phone`, `email`, `website`, `logo`, `is_active`, `created_by`, `created_at`, `updated_at`) VALUES
	(1, 'Bangladesh Navy', 'BN', 'Military', 'Naval Forces of Bangladesh', 'Naval Headquarters, Dhaka', '+880-2-9853871', 'info@navy.mil.bd', 'https://www.navy.mil.bd', NULL, 1, NULL, '2025-10-20 00:00:00', '2025-10-20 00:00:00');

-- Dumping structure for table cms_db.units
CREATE TABLE IF NOT EXISTS `units` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `code` varchar(20) NOT NULL,
  `description` text DEFAULT NULL,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `parent_id` int(11) DEFAULT NULL,
  `order_id` int(11) DEFAULT 1,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(11) 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 `code` (`code`),
  KEY `idx_name` (`name`),
  KEY `idx_is_active` (`is_active`),
  KEY `idx_organization_id` (`organization_id`),
  KEY `idx_parent_id` (`parent_id`),
  KEY `idx_created_by` (`created_by`),
  CONSTRAINT `units_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `units` (`id`) ON DELETE SET NULL,
  CONSTRAINT `units_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `units_ibfk_3` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.units: ~7 rows (approximately)
INSERT IGNORE INTO `units` (`id`, `name`, `code`, `description`, `organization_id`, `parent_id`, `order_id`, `is_active`, `created_by`, `created_at`, `updated_at`) VALUES
	(1, 'NHQ', 'NHQ', 'Naval Headquarters', 1, NULL, 1, 1, 1, '2025-10-07 09:50:31', '2025-10-11 09:49:25'),
	(2, 'Dhaka Naval Area', 'DNA', 'Dhaka Naval Area Command', 1, NULL, 2, 1, 1, '2025-10-07 09:50:31', '2025-10-11 09:54:32'),
	(3, 'Chittagong Naval Area', 'CNA', 'Chittagong Naval Area Command', 1, NULL, 3, 1, 1, '2025-10-07 09:50:31', '2025-10-11 09:55:17'),
	(4, 'Khulna Naval Area', 'KNA', 'Khulna Naval Area Command', 1, NULL, 4, 1, 1, '2025-10-07 09:50:31', '2025-10-11 09:49:36');

-- Dumping structure for table cms_db.users
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `login_id` varchar(100) DEFAULT NULL,
  `rank_id` int(11) DEFAULT NULL,
  `service_no` varchar(50) DEFAULT NULL,
  `unit_id` int(11) NOT NULL,
  `order_id` int(11) NOT NULL DEFAULT 1,
  `organization_id` int(11) NOT NULL DEFAULT 1,
  `department_id` int(11) DEFAULT NULL,
  `role_id` int(11) NOT NULL DEFAULT 3,
  `designation_id` int(11) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `alternative_mobile` varchar(20) DEFAULT NULL,
  `email` varchar(255) NOT NULL,
  `avatar` varchar(500) DEFAULT NULL,
  `status` enum('online','offline','busy') NOT NULL DEFAULT 'offline',
  `last_seen` timestamp NULL DEFAULT NULL,
  `password_hash` varchar(255) NOT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL 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`),
  UNIQUE KEY `service_no` (`service_no`),
  UNIQUE KEY `login_id` (`login_id`),
  UNIQUE KEY `unique_login_id` (`login_id`),
  KEY `idx_service_no` (`service_no`),
  KEY `idx_email` (`email`),
  KEY `idx_role_id` (`role_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_users_role_status` (`role_id`,`status`),
  KEY `idx_users_status_updated` (`status`,`updated_at`),
  KEY `idx_rank_id` (`rank_id`),
  KEY `idx_unit_id` (`unit_id`),
  KEY `idx_department_id` (`department_id`),
  KEY `idx_designation_id` (`designation_id`),
  KEY `idx_parent_id` (`parent_id`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`rank_id`) REFERENCES `ranks` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_ibfk_2` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`),
  CONSTRAINT `users_ibfk_3` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  CONSTRAINT `users_ibfk_4` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`),
  CONSTRAINT `users_ibfk_5` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  CONSTRAINT `users_ibfk_6` FOREIGN KEY (`parent_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=166 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.users: ~145 rows (approximately)
INSERT IGNORE INTO `users` (`id`, `name`, `login_id`, `rank_id`, `service_no`, `unit_id`, `order_id`, `organization_id`, `department_id`, `role_id`, `designation_id`, `phone`, `mobile`, `alternative_mobile`, `email`, `avatar`, `status`, `last_seen`, `password_hash`, `parent_id`, `is_active`, `created_at`, `updated_at`) VALUES
	(2, 'Super Admin', 's_admin', 1, 'BN10001', 1, 1, 1, 1, 1, 1, '+880211111111', '+8801811111111', '+8801811111111', 's_admin@gmail.com', NULL, 'offline', '2025-10-12 00:21:39', '$2a$10$wSP7ffhG.pqpil3rC9UkMehi/7unt3FNjAqIWadpa19AzQpONmNtG', NULL, 1, '2025-10-07 09:56:54', '2025-10-12 06:21:39'),
	(3, 'Admin', 'admin', 2, 'BN10002', 1, 1, 1, 1, 2, 2, '+880211111112', '+8801811111112', '+8801811111112', 'admin@gmail.com', NULL, 'offline', '2025-10-09 13:39:04', '$2a$10$kMUlyMUgmH.i7hWMsa7KzeCYGIzs.uSgzZOVbVE3PipWOfh0lueyO', NULL, 1, '2025-10-07 09:56:54', '2025-10-10 12:08:05'),
	(4, 'NHQ Admin', 'nhq_admin', NULL, 'SVC1760039398510', 1, 1, 1, 3, 6, 15, '+8809654545', '+02323123', '123123123213', 'nhqadmin@gmail.com', NULL, 'offline', '2025-10-12 00:29:17', '$2a$12$H1xV2g/k4lP.k8rdhICFiu7Lmu0Y6RQJxlP13NM.hmU7dSBFEekNe', NULL, 1, '2025-10-09 19:49:58', '2025-10-12 06:29:17'),
	(24, 'User', 'nhq_user', 5, 'BN10010', 1, 1, 1, 2, 3, 25, '+880211111120', '+8801811111120', '+8801811111120', 'navy@gmail.com', NULL, 'offline', '2025-10-12 00:26:16', '$2a$10$IRwspfCD3SYWvfJ.YSgYPeecZj4vEfmyV7ud2hLqoo5rCWtY.xrVy', NULL, 1, '2025-10-10 11:40:36', '2025-10-12 06:26:16'),
	(25, 'Major Sarah Johnson', NULL, 17, 'BN10011', 2, 1, 1, 2, 3, 35, '+880211111121', '+8801811111121', '', 'sarah.johnson@navy.mil', NULL, 'offline', NULL, '$2a$10$sA5oDFxi0AJb3eftRXSSzOOe1Oq/oMhm6frCITnbonmKal0VQiYX2', NULL, 0, '2025-10-10 11:40:36', '2025-10-11 13:01:44'),
	(26, 'Commander Lisa Davis1111', NULL, 6, 'BN10013', 1, 1, 1, 2, 2, 10, '+88021111112334343', '+8801811111123', '34343434', 'lisa.davis@navy.mil', NULL, 'offline', NULL, '$2a$10$QKGprACWWgpam74qaoAxVuAD7H0Nc2M4KB5Alb2NzPz34CRQ1nKYG', NULL, 1, '2025-10-10 11:40:37', '2025-10-10 14:33:13'),
	(27, 'Lieutenant Colonel Tom Wilson', NULL, 8, 'BN10014', 4, 1, 1, 3, 3, 14, '+880211111124', '+8801811111124', '+8801811111124', 'tom.wilson@navy.mil', NULL, 'offline', NULL, '$2a$10$acDQ0Tdj38PtvhzMQ.3bI.tLlHcby01.eqifvzbd.JAu7Ju8ut6hS', NULL, 0, '2025-10-10 11:40:37', '2025-10-10 12:01:46'),
	(28, 'Flag Lt', 'user_1760109368576_ini79qw3k', NULL, 'BN66278', 1, 1, 1, 1, 3, 4, '+880211366278', NULL, NULL, 'user66278@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$XeTGnzk/Pwa2aY.cYUp3YOXBw9vOzKSxPlynl2//Xc.BtPdv38/za', NULL, 1, '2025-10-10 15:16:08', '2025-10-10 15:16:08'),
	(29, 'Asst. Secy', 'user_1760109393375_usbb3p2ll', NULL, 'BN91200', 1, 1, 1, 1, 3, 3, '+880211391200', NULL, NULL, 'user91200@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$anawAojA4Fs38X/Dg05pw.I5tssYlD0SedWffkumzEIWcBK4ogwZu', NULL, 1, '2025-10-10 15:16:33', '2025-10-10 15:16:33'),
	(30, 'Protocol Offr', 'user_1760109412425_let0goucj', NULL, 'BN11062', 1, 1, 1, 1, 3, 5, '+880211411062', NULL, NULL, 'user11062@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$R0nvRGvkr7HtEidqb8bTAubX9Go.gA2hqIHa2Hxld5PKXUc0oGOqS', NULL, 1, '2025-10-10 15:16:52', '2025-10-10 15:16:52'),
	(31, 'Escort Offr', 'user_1760109426698_5fksk53ke', NULL, 'BN24309', 1, 1, 1, 1, 3, 6, '+880211424309', NULL, NULL, 'user24309@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$YhdBRqvnq8b7wri0Lec0VO4W7sUpof3fAEdNaMdDtm/1iW3XmyiK2', NULL, 1, '2025-10-10 15:17:06', '2025-10-10 15:17:06'),
	(32, 'NS', 'user_1760109464236_uidbzyl8b', NULL, 'BN62633', 1, 1, 1, 2, 3, 7, '+880211462633', NULL, NULL, 'user62633@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$tE/YIocR.gitvzl7nw.KieD.jxsnzl2O5LMv2kh5bXudtYgiDOLiC', NULL, 1, '2025-10-10 15:17:44', '2025-10-10 15:17:44'),
	(33, 'SONA-1', 'user_1760109498346_mg4abrz2s', NULL, 'BN96903', 1, 1, 1, 2, 3, 8, '+880211496903', NULL, NULL, 'user96903@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$x01YdJ0w6hDnMJ0IEJ3c7ebdaLQSOooytCAEQ0cV4jUFsRigWAQWS', NULL, 1, '2025-10-10 15:18:18', '2025-10-10 15:18:18'),
	(34, 'SONA-1 (Tec)', 'user_1760109513496_bnjfgx1ir', NULL, 'BN11309', 1, 1, 1, 2, 3, 9, '+880211511309', NULL, NULL, 'user11309@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$DrV8jy0ZApdevwjt9n1tqOY0GWBR1KLnRHaeQ2QZHCoTrp/9HUJBi', NULL, 1, '2025-10-10 15:18:33', '2025-10-10 15:18:33'),
	(35, 'SONA-2 (Plans)', 'user_1760109541487_9t5fx1mn1', NULL, 'BN39590', 1, 1, 1, 2, 3, 11, '+880211539590', NULL, NULL, 'user39590@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$NHL51JhY/I9tDulHccJk5O9h5Y2k6NVHKwKr56QVWmMkrfxFD1buG', NULL, 1, '2025-10-10 15:19:01', '2025-10-10 15:19:01'),
	(36, 'SO Tec', 'user_1760109567263_cdzul43a4', NULL, 'BN64973', 1, 1, 1, 2, 3, 12, '+880211564973', NULL, NULL, 'user64973@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$sT.CN7q3JEcssRBZkkz3COa0Pm43THWtuQgkOIXeagD53z3ntnuNy', NULL, 1, '2025-10-10 15:19:27', '2025-10-10 15:19:27'),
	(37, 'DA', 'user_1760109595256_n3sg72ltr', NULL, 'BN93019', 1, 1, 1, 3, 3, 13, '+880211593019', NULL, NULL, 'user93019@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$m.11t8zWzoVl7bi5fGHnQuhrp0ZcBJE9MPjq2sHyuwgwHpZCWNP3W', NULL, 1, '2025-10-10 15:19:55', '2025-10-10 15:19:55'),
	(38, 'DD Drafting', 'user_1760109607055_x8h5qidm3', NULL, 'BN4873', 1, 1, 1, 3, 3, 14, '+880211604873', NULL, NULL, 'user4873@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$OLiaRJPfSYjzFqww8pAte.gBNcWG.TR1Q4LUgbJSrn29un4zNolja', NULL, 1, '2025-10-10 15:20:07', '2025-10-10 15:20:07'),
	(39, 'Sec Comd-2', 'user_1760109628735_p5ya1vimo', NULL, 'BN26110', 1, 1, 1, 3, 3, 16, '+880211626110', NULL, NULL, 'user26110@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$zltRwxSbq3kngdqw387EP.2uvj10jji0PsZN93SGM.voUozJwkcxO', NULL, 1, '2025-10-10 15:20:28', '2025-10-10 15:20:28'),
	(40, 'Sec Comd-3', 'user_1760109642604_4jzzme7gy', NULL, 'BN40250', 1, 1, 1, 3, 3, 17, '+880211640250', NULL, NULL, 'user40250@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Fk0n5W/OhcdzgVEDOYZ7ReNNM.CnAkaX42LV.Ywq.hdJ7uVBcMfRa', NULL, 1, '2025-10-10 15:20:42', '2025-10-10 15:20:42'),
	(41, 'CNS', 'user_1760159045342_5dgoj5isz', NULL, 'BN44281', 1, 1, 1, 22, 3, 1, '+88021144281', NULL, NULL, 'user44281@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Z2YzA/.6NcNZshrqvmctM.QCTBvs9VvXqLtNfVtFzgXIInifhkil.', NULL, 1, '2025-10-11 05:04:05', '2025-10-11 05:04:05'),
	(42, 'Secy to CNS', 'user_1760159062119_yxhhau22g', NULL, 'BN61002', 1, 1, 1, 22, 3, 2, '+88021161002', NULL, NULL, 'user61002@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$YTyClQ.tW4VEIpu3jSR6ceFLoEEVjDJvZqk.ZtnDEOQpSdLt12X5W', NULL, 1, '2025-10-11 05:04:22', '2025-10-11 05:04:22'),
	(43, 'Asst Secy', 'user_1760159081380_0gctoj0yw', NULL, 'BN80411', 1, 1, 1, 22, 3, 3, '+88021180411', NULL, NULL, 'user80411@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$vwLKkXtpCQdZ/h/cPm52MO6g/Hl8o9N9juN4wzepf1XS9Xij/y6FS', NULL, 1, '2025-10-11 05:04:41', '2025-10-11 05:04:41'),
	(44, 'Flag Lt', 'user_1760159092352_2ktv2nex7', NULL, 'BN89993', 1, 1, 1, 22, 3, 4, '+88021189993', NULL, NULL, 'user89993@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$zO8UDNed9JoGNFI5goJmAOZT44jZT5ctDUXjimOJcaHxhafL/zXWu', NULL, 1, '2025-10-11 05:04:52', '2025-10-11 05:04:52'),
	(45, 'Protocol Offr', 'user_1760159112863_7w2zhfvbh', NULL, 'BN7597', 1, 1, 1, 22, 3, 5, '+880211107597', NULL, NULL, 'user7597@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$I2K2IqVm.z3NSJqvM70nVOa1zYhswdrV/30yJNI4vg5ixGGAaIIFS', NULL, 1, '2025-10-11 05:05:13', '2025-10-11 05:05:13'),
	(46, 'Escort Offr', 'user_1760159120802_wopvlf75w', NULL, 'BN19644', 1, 1, 1, 22, 3, 6, '+880211119644', NULL, NULL, 'user19644@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$M40WENjExnZy5SN0UGvfmO.zJ4bMEwaI2Uaz32r4j4QtKj2HxOlK6', NULL, 1, '2025-10-11 05:05:21', '2025-10-11 05:05:21'),
	(47, 'NS', 'user_1760160018439_l34j38vr5', NULL, 'BN16621', 1, 1, 1, 23, 3, 7, '+88021116621', NULL, NULL, 'user16621@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$R76MQMQsuJV69.ZJe6vPR..KeGvKSXfxRriCGDTGXeKr6oWEsJMFy', NULL, 1, '2025-10-11 05:20:18', '2025-10-11 05:20:18'),
	(48, 'SONA-1', 'user_1760160031194_op05ui2hd', NULL, 'BN29467', 1, 1, 1, 23, 3, 8, '+88021129467', NULL, NULL, 'user29467@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$07f1oAYREt1h.pLNNLE1/uonneTkMPT3Z4sOI/ma3IZQY1OiX7v2q', NULL, 1, '2025-10-11 05:20:31', '2025-10-11 05:20:31'),
	(49, 'SONA-1 (Tec)', 'user_1760160041797_srt5gr9oj', NULL, 'BN40018', 1, 1, 1, 23, 3, 9, '+88021140018', NULL, NULL, 'user40018@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$VGVqnIeQb.MQ4OrhJ0WMguhAWsAtoyGoj0nEjfd9wWSOZHerX27vK', NULL, 1, '2025-10-11 05:20:42', '2025-10-11 05:20:42'),
	(50, 'SONA-2', 'user_1760160049328_jyysiofac', NULL, 'BN48052', 1, 1, 1, 23, 3, 10, '+88021148052', NULL, NULL, 'user48052@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$I3DFmmGsZDeNLbEI0TfnyunRAiLvo57SsE/OHh3EXnfL/tqFyYksu', NULL, 1, '2025-10-11 05:20:49', '2025-10-11 05:20:49'),
	(51, 'SONA-2 (Plans)', 'user_1760160101819_i8gepnidv', NULL, 'BN392', 1, 1, 1, 23, 3, 11, '+880211100392', NULL, NULL, 'user392@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$/EdCx3NTWfTs2JMaVVbTluv9FssrZi5QFxXft8MLw9A5EYfBrYTre', NULL, 1, '2025-10-11 05:21:42', '2025-10-11 05:21:42'),
	(52, 'SO Tec', 'user_1760160134354_oc8kqz9qo', NULL, 'BN32923', 1, 1, 1, 23, 3, 12, '+880211132923', NULL, NULL, 'user32923@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$HXBN8LxuWUIDtgvFO3db5OedUNIHeGVkelGqeoV2pQGJMTYUdxvcy', NULL, 1, '2025-10-11 05:22:14', '2025-10-11 05:22:14'),
	(53, 'DA', 'user_1760160156190_xzrqsjqxz', NULL, 'BN54418', 1, 1, 1, 24, 3, 13, '+880211154418', NULL, NULL, 'user54418@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Wm8pKSsTbylcPTmhyQ.wWOqo1PHhBgsxrp/CHC1yOTcO1mfOrkXQy', NULL, 1, '2025-10-11 05:22:36', '2025-10-11 05:22:36'),
	(54, 'DD Drafting', 'user_1760160166230_czyc7zsa4', NULL, 'BN64341', 1, 1, 1, 24, 3, 14, '+880211164341', NULL, NULL, 'user64341@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$AEUPz9Ez4PBXWRXQN3mVeuMqPT0PhoYcSCQzCWTLSiO05MYZZ2Wwq', NULL, 1, '2025-10-11 05:22:46', '2025-10-11 05:22:46'),
	(55, 'Sec Comd-1', 'user_1760160173915_8anvhddv7', NULL, 'BN72014', 1, 1, 1, 24, 3, 15, '+880211172014', NULL, NULL, 'user72014@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$54G77ZnFPeOeNSYIkVItpuj/8eCciOmjK8YMdtpNzwDdBhzp2.MSu', NULL, 1, '2025-10-11 05:22:54', '2025-10-11 05:22:54'),
	(56, 'Sec Comd-2', 'user_1760160178848_ale54mk5s', NULL, 'BN77776', 1, 1, 1, 24, 3, 16, '+880211177776', NULL, NULL, 'user77776@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$yNwEU2uTfWEp8SvEs6Ixk.7gmmWYN/kADGLUQcIQvGOMRQqdbo/XW', NULL, 1, '2025-10-11 05:22:59', '2025-10-11 05:22:59'),
	(57, 'Sec Comd-3', 'user_1760160183959_6ciu4044x', NULL, 'BN82987', 1, 1, 1, 24, 3, 17, '+880211182987', NULL, NULL, 'user82987@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$qLnsXLFjBk4z5C2f1HR.EupIcVi3HWkDbR37ucJsDQfpcvkg4ez1y', NULL, 1, '2025-10-11 05:23:04', '2025-10-11 05:23:04'),
	(58, 'JAG', 'user_1760160275936_hnxd69nb2', NULL, 'BN74758', 1, 1, 1, 25, 3, 18, '+880211274758', NULL, NULL, 'user74758@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Z5jCs6OGJkLPEBG73gDvpum1m4xXGQbY2b6ZL7Y.e4VZDYPpugwDy', NULL, 1, '2025-10-11 05:24:36', '2025-10-11 05:24:36'),
	(59, 'DD JAG', 'user_1760160286863_d6cj6f40y', NULL, 'BN85851', 1, 1, 1, 25, 3, 19, '+880211285851', NULL, NULL, 'user85851@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$flZ0aj21z6ZZXUsdK0tgM.QOPKsIsxDDTKoeZp87dqmnPMigQxJVy', NULL, 1, '2025-10-11 05:24:47', '2025-10-11 05:24:47'),
	(60, 'SO (JAG)', 'user_1760160296324_mrt6fwk37', NULL, 'BN94481', 1, 1, 1, 25, 3, 20, '+880211294481', NULL, NULL, 'user94481@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$JC3Y5CimOlwGasP.0jsT2.VI7.byRm7J0UI1OvahuUphG9IcFGj3G', NULL, 1, '2025-10-11 05:24:56', '2025-10-11 05:24:56'),
	(61, 'ACNS (O)', 'user_1760160548832_179h8amqg', NULL, 'BN46999', 1, 1, 1, 30, 3, 21, '+880211546999', NULL, NULL, 'user46999@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$K9RuvqlP8x8fn0XP2t6.cuqV1sxIAO2ft7/liVXeHT3dgA3WtQW0i', NULL, 1, '2025-10-11 05:29:09', '2025-10-11 05:29:09'),
	(62, 'Coord to ACNS (O)', 'user_1760160618355_eofekhch9', NULL, 'BN16595', 1, 1, 1, 30, 3, 22, '+880211616595', NULL, NULL, 'user16595@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$LYuPhO6KUiMv5XW45MhNyeMUlWcajSE4r9zaXy0bfJlVvA9f26Jx6', NULL, 1, '2025-10-11 05:30:18', '2025-10-11 05:30:18'),
	(63, 'DDNO', 'user_1760161874061_phqiuk1be', NULL, 'BN73004', 1, 1, 1, 31, 3, 23, '+880211873004', NULL, NULL, 'user73004@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$NCEmfoNVo752C/vGUa6AIOfQfvdqwmLM4EwyEzwRVR4sp2IoRsXri', NULL, 1, '2025-10-11 05:51:14', '2025-10-11 05:51:14'),
	(64, 'SO (O)', 'user_1760161883821_wgrxh9nkw', NULL, 'BN82792', 1, 1, 1, 31, 3, 24, '+880211882792', NULL, NULL, 'user82792@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$kiO/HWKOX/Khzy3vxXrT8.xkoP/UY6eAEUC/cwUyWBIXOBZSXQcRC', NULL, 1, '2025-10-11 05:51:24', '2025-10-11 05:51:24'),
	(65, 'SO (Ops Plan)', 'user_1760161890978_k0sysl0sa', NULL, 'BN89945', 1, 1, 1, 31, 3, 25, '+880211889945', NULL, NULL, 'user89945@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$DFxPmmk/cxCq7hVKKU9Yt.Jr3GRBVCb.K8qliWB9YYpFSY/SoKbKG', NULL, 1, '2025-10-11 05:51:31', '2025-10-11 05:51:31'),
	(66, 'DDNI', 'user_1760161910904_78w00pwc1', NULL, 'BN9031', 1, 1, 1, 32, 3, 26, '+880211909031', NULL, NULL, 'user9031@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$/7QoUcDp9kMTV8DTBlMv/u2BLmsBo2aW/1MdMOuFRsEwpAwMRcOW6', NULL, 1, '2025-10-11 05:51:51', '2025-10-11 05:51:51'),
	(67, 'SO (l)', 'user_1760161926518_40m1b5hxn', NULL, 'BN24250', 1, 1, 1, 32, 3, 27, '+880211924250', NULL, NULL, 'user24250@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Nl.EaSx.BvVtldzsIGHZmexm2p7KENMseUGv.cODap4YbsIpLvyfG', NULL, 1, '2025-10-11 05:52:06', '2025-10-11 05:52:06'),
	(68, 'SO (Cl)', 'user_1760161942545_j5rhksje3', NULL, 'BN40366', 1, 1, 1, 32, 3, 28, '+880211940366', NULL, NULL, 'user40366@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$lCxo/DuY3isrzKlpEHtU1uqvqNKtYMiwjxsRwymD//eLPQfvepMGe', NULL, 1, '2025-10-11 05:52:22', '2025-10-11 05:52:22'),
	(69, 'SO (Tec)', 'user_1760161959113_3g9ijt0ee', NULL, 'BN57990', 1, 1, 1, 32, 3, 29, '+880211957990', NULL, NULL, 'user57990@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$OXx1MfzSmtGXBsITRNxVgutUbYEDm62TxQ2XKF6IKRyMCqde1n3ti', NULL, 1, '2025-10-11 05:52:39', '2025-10-11 05:52:39'),
	(70, 'SO (Media)', 'user_1760161968258_fk7oofbfa', NULL, 'BN67246', 1, 1, 1, 32, 3, 30, '+880211967246', NULL, NULL, 'user67246@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$.6bYJiOGsGMVrr5mBC9vE.ytvRAj4I5kXLXZYdS4C029VeJmPmvte', NULL, 1, '2025-10-11 05:52:48', '2025-10-11 05:52:48'),
	(71, 'DDNP', 'user_1760161992809_3xx64szut', NULL, 'BN90663', 1, 1, 1, 33, 3, 31, '+880211990663', NULL, NULL, 'user90663@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$mBdnmgqGYP03vrHo5sCFbuUCrzUB.TTo0Tx.5MJ0C3yNa.f7IlXnW', NULL, 1, '2025-10-11 05:53:13', '2025-10-11 05:53:13'),
	(72, 'SO (Plan-1)', 'user_1760162003101_fqu9sgabt', NULL, 'BN1166', 1, 1, 1, 33, 3, 32, '+8802111166', NULL, NULL, 'user1166@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$jSAHCk/cA/cO59LiY.mREe6ykGmNe3GXEAqZ81bk1B9TP/ufQuN7G', NULL, 1, '2025-10-11 05:53:23', '2025-10-11 05:53:23'),
	(73, 'SO (Plans-2)', 'user_1760162011127_cyq5v55il', NULL, 'BN8429', 1, 1, 1, 33, 3, 33, '+8802118429', NULL, NULL, 'user8429@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$I1QzRHQf11GCHX7qkQY2xOv2zHb.sntMjCSiO30Tkab5onvmdWtt2', NULL, 1, '2025-10-11 05:53:31', '2025-10-11 05:53:31'),
	(74, 'DD Sig', 'user_1760162043961_3lluolmbl', NULL, 'BN41640', 1, 1, 1, 34, 3, 34, '+88021141640', NULL, NULL, 'user41640@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$HsXXBDMYLvEu1mouuRt02OSdI9RjsdgqSdLWpPFJS8.xdiPQCwb2i', NULL, 1, '2025-10-11 05:54:04', '2025-10-11 05:54:04'),
	(75, 'SO (Sig)1', 'user_1760162051954_12r0akwxk', NULL, 'BN50045', 1, 1, 1, 34, 3, 35, '+88021150045', NULL, NULL, 'user50045@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$7SfJrEbpfCHjTNm4TUrY1ekfvuPwWrFilLS1QmgTfvVGTfiCkYf5C', NULL, 0, '2025-10-11 05:54:12', '2025-10-11 12:59:23'),
	(76, 'DD Works', 'user_1760162072302_pb1ofsb9v', NULL, 'BN71113', 1, 1, 1, 35, 3, 36, '+88021171113', NULL, NULL, 'user71113@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$seoJUCl2DllqGNcKhYKqZ.CqJS9trd7kOldy.Sen5Gxk/YDSOtx.i', NULL, 1, '2025-10-11 05:54:32', '2025-10-11 05:54:32'),
	(77, 'SO (Works)', 'user_1760162078532_03lgebeh9', NULL, 'BN77463', 1, 1, 1, 35, 3, 37, '+88021177463', NULL, NULL, 'user77463@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$dsbnwfTvXQLIiXASOTgTnu0GS35NFh0rzrE9iUvwP3xtGNBPpjeI6', NULL, 1, '2025-10-11 05:54:38', '2025-10-11 05:54:38'),
	(78, 'DD Nav', 'user_1760162100171_bnz59mt2l', NULL, 'BN94949', 1, 1, 1, 36, 3, 38, '+88021194949', NULL, NULL, 'user94949@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$85FjhYzv5/XEBMXfbYW5R.ecFDcEiouvlxl5h.Zaf3F/ghqXKVuYu', NULL, 1, '2025-10-11 05:55:00', '2025-10-11 05:55:00'),
	(79, 'SO (Nav)', 'user_1760162106779_85byuu19j', NULL, 'BN5665', 1, 1, 1, 36, 3, 39, '+880211105665', NULL, NULL, 'user5665@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$R0rtqlbtHXZJ0r2cMPv93uPTBwlrBKn2LNcpcntitfUvO.bzN06Oq', NULL, 1, '2025-10-11 05:55:07', '2025-10-11 05:55:07'),
	(80, 'DD Hydro', 'user_1760162133342_xgpjnw4zb', NULL, 'BN31489', 1, 1, 1, 37, 3, 40, '+880211131489', NULL, NULL, 'user31489@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$ObcuFlK..NuPZZe1G9/xSeIJ90R2iQtsK5jnzFQXttid8DlliDLu.', NULL, 1, '2025-10-11 05:55:33', '2025-10-11 05:55:33'),
	(81, 'SO (Hydro)', 'user_1760162142877_62i6slwon', NULL, 'BN41816', 1, 1, 1, 37, 3, 41, '+880211141816', NULL, NULL, 'user41816@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$xh7DdsxDx6tLfdBloKSZceO6sJeDHiNuC/rKnC.DOXjTpWb4IDIaS', NULL, 1, '2025-10-11 05:55:43', '2025-10-11 05:55:43'),
	(82, 'Capt Staff', 'user_1760162161891_kfpioap9g', NULL, 'BN60703', 1, 1, 1, 38, 3, 42, '+880211160703', NULL, NULL, 'user60703@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$pIN8aLwqoXWN27l8cNjUZuVePGyeXA5NipB0uHco0zrTXhOn99ZH2', NULL, 1, '2025-10-11 05:56:02', '2025-10-11 05:56:02'),
	(83, 'DD Sub', 'user_1760162172191_00weglpz8', NULL, 'BN71051', 1, 1, 1, 38, 3, 43, '+880211171051', NULL, NULL, 'user71051@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$tY017uZaueHM0OEvhNOgWuJ33W8YiYmtGgWRDYkU4lmfJ6LpIcu5O', NULL, 1, '2025-10-11 05:56:12', '2025-10-11 05:56:12'),
	(84, 'DD Sub (Tec)', 'user_1760162182269_jdjc11mko', NULL, 'BN80878', 1, 1, 1, 38, 3, 44, '+880211180878', NULL, NULL, 'user80878@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Lex3lofwNuniRH7pgQHKeeek9bHUl.qAPIMUbAywg6HXHgBldGZdq', NULL, 1, '2025-10-11 05:56:22', '2025-10-11 05:56:22'),
	(85, 'So (Sub)', 'user_1760162189641_2gc2uax5h', NULL, 'BN88481', 1, 1, 1, 38, 3, 45, '+880211188481', NULL, NULL, 'user88481@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$KuU/gico0VIeVdi5vgfrceQhd0BRWRfYk/KobwJnRkmGsYzNGRltu', NULL, 1, '2025-10-11 05:56:29', '2025-10-11 05:56:29'),
	(86, 'DD Spl Ops', 'user_1760162213164_yvu2kd3be', NULL, 'BN11757', 1, 1, 1, 39, 3, 46, '+880211211757', NULL, NULL, 'user11757@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Kctjp/t/JQSG1TT/WAy74Obn9WJ9tLYMxzAD2o2LCFJn5FehPuwgy', NULL, 1, '2025-10-11 05:56:53', '2025-10-11 05:56:53'),
	(87, 'SO (Spl Ops)', 'user_1760162226136_f7oi2bi9v', NULL, 'BN24385', 1, 1, 1, 39, 3, 47, '+880211224385', NULL, NULL, 'user24385@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$zQwQLGEAcDP.1bLBvKfpk.8lrTfpsHol09hpPqU/CnKlmniBkwTom', NULL, 1, '2025-10-11 05:57:06', '2025-10-11 05:57:06'),
	(88, 'DD SD & C', 'user_1760162240354_l52avcdr2', NULL, 'BN38545', 1, 1, 1, 40, 3, 48, '+880211238545', NULL, NULL, 'user38545@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$WwS65MT00NZyNNlQhZsLMuTzNX.RsAvdpI4EQnUwMRBS8Cy6Xs9w6', NULL, 1, '2025-10-11 05:57:20', '2025-10-11 05:57:20'),
	(89, 'SO (SD & C)', 'user_1760162252923_geug61ao0', NULL, 'BN51024', 1, 1, 1, 40, 3, 49, '+880211251024', NULL, NULL, 'user51024@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$GZYvvwsEr0Zfjbn3WEd7Yuqf4EFtk5EXPvqqvpudQtOk5w/vxrMW6', NULL, 1, '2025-10-11 05:57:33', '2025-10-11 05:57:33'),
	(90, 'DDONO', 'user_1760162266374_et8xkmpjn', NULL, 'BN64159', 1, 1, 1, 41, 3, 50, '+880211264159', NULL, NULL, 'user64159@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Id/O3sx30CYwFNPxdlgkaOLkTDbn/rqfc.aM53t7bPByCD/wWxGKS', NULL, 1, '2025-10-11 05:57:46', '2025-10-11 05:57:46'),
	(91, 'SO (ONO)', 'user_1760162275609_kmep4031q', NULL, 'BN73437', 1, 1, 1, 41, 3, 51, '+880211273437', NULL, NULL, 'user73437@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$1Q8PK1U4AdKLbSZMmvz9ceLIFjNSCSCsNT07daJzAaMOuqWx7z2D.', NULL, 1, '2025-10-11 05:57:55', '2025-10-11 05:57:55'),
	(92, 'ACNS (O)', 'user_1760177439827_r9fgomp3n', NULL, 'BN38649', 1, 1, 1, 43, 3, 52, '+880211438649', NULL, NULL, 'user38649@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$SHvjQjJQWegIWLmJH/wlIuTY2zxYlaReJWMqVQxWAoFUsa4v7iFOy', NULL, 1, '2025-10-11 10:10:40', '2025-10-11 13:00:56'),
	(93, 'Coord to ACNS (O)', 'user_1760177447688_ygpmdehep', NULL, 'BN46743', 1, 1, 1, 43, 3, 53, '+880211446743', NULL, NULL, 'user46743@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$s/GYShunYDESQMqRkLMDXuErSgo8vt4iE.ljkOqVTY9a8ZMQH7F1K', NULL, 1, '2025-10-11 10:10:47', '2025-10-11 13:00:59'),
	(94, 'DDNPS', 'user_1760177470084_svwx9mw89', NULL, 'BN68279', 1, 1, 1, 44, 3, 54, '+880211468279', NULL, NULL, 'user68279@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$TTCfXWFEAAgHHmBZlN.1wuGPfbGWYTGLepSdoJU/9OOtKw1kN.nmm', NULL, 1, '2025-10-11 10:11:10', '2025-10-11 10:11:10'),
	(95, 'SO (Pers)', 'user_1760177488145_fn3lyuc4o', NULL, 'BN86071', 1, 1, 1, 44, 3, 55, '+880211486071', NULL, NULL, 'user86071@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$VCu1sC6l2uUSVr1aa58E4ORlJmyBxfiQzC6JoqB4WJas4U4lFEBCy', NULL, 1, '2025-10-11 10:11:28', '2025-10-11 10:11:28'),
	(96, 'DDNT', 'user_1760177503493_fp3v6zz89', NULL, 'BN2572', 1, 1, 1, 45, 3, 56, '+880211502572', NULL, NULL, 'user2572@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$XcXUilgD.Cj3JX17x3i21.HGSXOOmMsRccgXvf5TH2u23E2PynhMi', NULL, 1, '2025-10-11 10:11:43', '2025-10-11 10:11:43'),
	(97, 'SO (T-1)', 'user_1760177514240_tp5zlgnsb', NULL, 'BN12593', 1, 1, 1, 45, 3, 57, '+880211512593', NULL, NULL, 'user12593@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$zlzWRJxvyEh5bpmBx9MDYe7VliiAolp0sN48UK942ihvtSZT2Jqv.', NULL, 1, '2025-10-11 10:11:54', '2025-10-11 10:11:54'),
	(98, 'SO (T-2)', 'user_1760177524217_wmekqd69z', NULL, 'BN22162', 1, 1, 1, 45, 3, 58, '+880211522162', NULL, NULL, 'user22162@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$hHoQFoIItqiP/SPTsOVM7e1Y2HveLgc88mpVp9psM9j/LYZfO3.YK', NULL, 1, '2025-10-11 10:12:04', '2025-10-11 10:12:04'),
	(99, 'SO', 'user_1760177533536_602wvigzw', NULL, 'BN30872', 1, 1, 1, 45, 3, 59, '+880211530872', NULL, NULL, 'user30872@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$hUugLeQ2hG/zpDoZSqvRTe10YWCaf1IBZdzIFk8E5FfP0elmKJDDq', NULL, 1, '2025-10-11 10:12:13', '2025-10-11 10:12:13'),
	(100, 'DD Wel', 'user_1760177554873_guwuoqmb4', NULL, 'BN52828', 1, 1, 1, 46, 3, 60, '+880211552828', NULL, NULL, 'user52828@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$I.nWbM3KQuGPhlXGYEQ1JOX6I7o2RAdtldsINbd6LHyUK0yoZLR0a', NULL, 1, '2025-10-11 10:12:35', '2025-10-11 10:12:35'),
	(101, 'SO (Wel)', 'user_1760177564863_9tucn3pt0', NULL, 'BN63596', 1, 1, 1, 46, 3, 61, '+880211563596', NULL, NULL, 'user63596@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$f95h8oeIBIH4Xz3Rf3muneMv4OEKTiMKhEPLwNd7z5SobiNw5gYQC', NULL, 1, '2025-10-11 10:12:45', '2025-10-11 10:12:45'),
	(102, 'DDMS', 'user_1760177580192_5oqiw1s71', NULL, 'BN78481', 1, 1, 1, 47, 3, 62, '+880211578481', NULL, NULL, 'user78481@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$6pU6nENQuFB/fGEfdh8opuWDBC3oTFucg9pkHLcpYiXkV7C9rAOqe', NULL, 1, '2025-10-11 10:13:00', '2025-10-11 10:13:00'),
	(103, 'SO', 'user_1760177588140_o5suyvfnn', NULL, 'BN87163', 1, 1, 1, 47, 3, 63, '+880211587163', NULL, NULL, 'user87163@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$bnw3knTmuuwN8nzI2hZX2eFAUlJBfWp5KWYulr5CnNl.f1LyYpLci', NULL, 1, '2025-10-11 10:13:08', '2025-10-11 10:13:08'),
	(104, 'DD Edn', 'user_1760177614056_s7g0d2mwt', NULL, 'BN12444', 1, 1, 1, 48, 3, 64, '+880211612444', NULL, NULL, 'user12444@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$MAGgaKZsqxS463tirlr8Susc2s0S3Lc8zSybie3d8qucwFoJ78zt.', NULL, 1, '2025-10-11 10:13:34', '2025-10-11 10:13:34'),
	(105, 'SO (Edn)', 'user_1760177622960_7c3jpiecu', NULL, 'BN22081', 1, 1, 1, 48, 3, 65, '+880211622081', NULL, NULL, 'user22081@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$JQiyoJdkwAHXHjyNK2rl6.cU3cA4MPglFVItmEvq2AkhytWuye6z2', NULL, 1, '2025-10-11 10:13:43', '2025-10-11 10:13:43'),
	(106, 'DD Nav', 'user_1760177641198_f3cjjo9jq', NULL, 'BN39579', 1, 1, 1, 49, 3, 66, '+880211639579', NULL, NULL, 'user39579@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$5IG0Oli8Myd4QH/s2yc29uRe/F53t3BVSbSXYZsP54TJYkqN6Imoe', NULL, 1, '2025-10-11 10:14:01', '2025-10-11 10:14:01'),
	(107, 'SO (Nav)', 'user_1760177651422_s1fz922nc', NULL, 'BN50573', 1, 1, 1, 49, 3, 67, '+880211650573', NULL, NULL, 'user50573@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$YWYoIyzRU8jfSWz6z1kxMOidmYxWL8j5l//AB9BOjNpU.i.D5Ijm2', NULL, 1, '2025-10-11 10:14:11', '2025-10-11 10:14:11'),
	(108, 'ACNS (O)', 'user_1760180704303_edeauobja', NULL, 'BN3284', 1, 1, 1, 51, 3, 68, '+880211703284', NULL, NULL, 'user3284@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$QU5meHwWpX3xW2sNlXTKCurMADyEJiQ2zfBe3X5gbgPxGrV2LvSqe', NULL, 1, '2025-10-11 11:05:04', '2025-10-11 11:05:04'),
	(109, 'Coord to ACNS (O)', 'user_1760180711272_7q1j530yv', NULL, 'BN10130', 1, 1, 1, 51, 3, 69, '+880211710130', NULL, NULL, 'user10130@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$0tNmGurIGkTKamrYrG.nf.BMsl7eNNGfwGIN/B4Ocyo3RPbWIJQc6', NULL, 1, '2025-10-11 11:05:11', '2025-10-11 11:05:11'),
	(110, 'DDNO', 'user_1760180724939_50on028eb', NULL, 'BN22932', 1, 1, 1, 53, 3, 70, '+880211722932', NULL, NULL, 'user22932@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$KlaR11huyIAiDajopxqZ2uu2JIKrRlPv.URDMMtpBTySLQDtmRIUW', NULL, 1, '2025-10-11 11:05:25', '2025-10-11 11:05:25'),
	(111, 'SO (O)', 'user_1760180735750_jj8793oga', NULL, 'BN34194', 1, 1, 1, 53, 3, 71, '+880211734194', NULL, NULL, 'user34194@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$7gk2ONl9sCnPpJu4QCoMLulYCoBXJI.OvXAUogm6rfgCHIPvaPdfK', NULL, 1, '2025-10-11 11:05:35', '2025-10-11 11:05:35'),
	(112, 'SO (Ops Plan)', 'user_1760180744499_rhhf1f9fk', NULL, 'BN43534', 1, 1, 1, 53, 3, 72, '+880211743534', NULL, NULL, 'user43534@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$2NDnaYAAlNJWcCNt2NhS5.RTQPlTXp5QUHhPR4FsRSmLVfWUCEGTe', NULL, 1, '2025-10-11 11:05:44', '2025-10-11 11:05:44'),
	(113, 'DDNI', 'user_1760180759754_gj26v445a', NULL, 'BN58033', 1, 1, 1, 55, 3, 73, '+880211758033', NULL, NULL, 'user58033@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$zEcAMAikGVLDxfOy2U4CMeZ0virRLJXf86pUJKl.kMx0wV3fidWCy', NULL, 1, '2025-10-11 11:05:59', '2025-10-11 11:05:59'),
	(114, 'SO (l)', 'user_1760180770372_a4i7t372p', NULL, 'BN68616', 1, 1, 1, 55, 3, 74, '+880211768616', NULL, NULL, 'user68616@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$cnRiCAMrJGBnREIkTPh1KOsKlmjRN37Q43BBu9SFBqxqp.tLuI/WO', NULL, 1, '2025-10-11 11:06:10', '2025-10-11 11:06:10'),
	(115, 'SO (Cl)', 'user_1760180781244_pew6u0tbi', NULL, 'BN79437', 1, 1, 1, 55, 3, 75, '+880211779437', NULL, NULL, 'user79437@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$KmB5z/S.tGU64IMjRMns0Obcd/ueYP0M9bxMx.HAMM7RTKILj2y2G', NULL, 1, '2025-10-11 11:06:21', '2025-10-11 11:06:21'),
	(116, 'SO (Tec)', 'user_1760180789113_61npbp31z', NULL, 'BN88028', 1, 1, 1, 55, 3, 76, '+880211788028', NULL, NULL, 'user88028@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$6VogsCk5tM6VuaPl3zK1pu0uFL.pvHXmwom6MaJr4MBTk5TGLWlx2', NULL, 1, '2025-10-11 11:06:29', '2025-10-11 11:06:29'),
	(117, 'SO (Media)', 'user_1760180794173_gdpx6ytxm', NULL, 'BN93156', 1, 1, 1, 55, 3, 77, '+880211793156', NULL, NULL, 'user93156@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$jZBWSbOCMsLt0GLknygpQug2ZMpgcRDSgX9OfYlQvNgdmOnx/se82', NULL, 1, '2025-10-11 11:06:34', '2025-10-11 11:06:34'),
	(118, 'DDNP', 'user_1760180812272_kesf0w13k', NULL, 'BN10526', 1, 1, 1, 56, 3, 78, '+880211810526', NULL, NULL, 'user10526@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$T4XRTTnZCTS1cu/8jupDJe9wfsdAZ9uxQxXIZTMNVW1yM9pHb8T46', NULL, 1, '2025-10-11 11:06:52', '2025-10-11 11:06:52'),
	(119, 'SO (Plan-1)', 'user_1760180818283_jfdszuk4d', NULL, 'BN17173', 1, 1, 1, 56, 3, 79, '+880211817173', NULL, NULL, 'user17173@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$gMi5Q5ZincmBDdkorEqcsum1qhP50DKHqaVnBVYuoUJMtJkqRwSdG', NULL, 1, '2025-10-11 11:06:58', '2025-10-11 11:06:58'),
	(120, 'SO (Plans-2)', 'user_1760180823323_urdc0xu7y', NULL, 'BN22324', 1, 1, 1, 56, 3, 80, '+880211822324', NULL, NULL, 'user22324@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$2UBtSnitLobBXmihV2bZuOBgc/E2izPzhfQy.HTB3Wxvn4UqgB1Te', NULL, 1, '2025-10-11 11:07:03', '2025-10-11 11:07:03'),
	(121, 'DD Sig', 'user_1760180836850_xxkebp8w2', NULL, 'BN33725', 1, 1, 1, 58, 3, 81, '+880211833725', NULL, NULL, 'user33725@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$LBWXDE5GWlEBXjnmKe4b1.gLka5ouS8q2wU5PXl84GOOXMfhXV3t2', NULL, 1, '2025-10-11 11:07:17', '2025-10-11 11:07:17'),
	(122, 'SO (Sig)', 'user_1760180844159_cfz842mn0', NULL, 'BN43206', 1, 1, 1, 58, 3, 82, '+880211843206', NULL, NULL, 'user43206@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$1o6GoQp4eEnQpomvHMR64e7IwiX8fmSdjIaIykGccMfas/GegCv5C', NULL, 1, '2025-10-11 11:07:24', '2025-10-11 11:07:24'),
	(123, 'DD Works', 'user_1760180867241_ye75l04mh', NULL, 'BN66215', 1, 1, 1, 59, 3, 83, '+880211866215', NULL, NULL, 'user66215@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Dfi0eJzpfVwJknsjakO17.hjpZ0xcFpGdNPgWEqTfPQtxnW0Q9zlm', NULL, 1, '2025-10-11 11:07:47', '2025-10-11 11:07:47'),
	(124, 'SO (Works)', 'user_1760180875980_zdde6xd44', NULL, 'BN75101', 1, 1, 1, 59, 3, 84, '+880211875101', NULL, NULL, 'user75101@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$8DopZy47nDX3WTkKy3YidumPQxY9.TDgmQMoh3crwpGShfPECr3f2', NULL, 1, '2025-10-11 11:07:56', '2025-10-11 11:07:56'),
	(125, 'DD Nav', 'user_1760180888968_0emu02vs7', NULL, 'BN86936', 1, 1, 1, 60, 3, 85, '+880211886936', NULL, NULL, 'user86936@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$LY9yLFwuZnuruRLpyljNs.IfDyhSGd9Bqz6c575kqPShjVWcrzlVe', NULL, 1, '2025-10-11 11:08:09', '2025-10-11 11:08:09'),
	(126, 'SO (Nav)', 'user_1760180896307_keoh6mn71', NULL, 'BN95440', 1, 1, 1, 60, 3, 86, '+880211895440', NULL, NULL, 'user95440@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$X9RDF9o.Yprl9mnutG642.fUBjGYlztbwPrUbPpPHf2oUL/7H/i8G', NULL, 1, '2025-10-11 11:08:16', '2025-10-11 11:08:16'),
	(127, 'DD Hydro', 'user_1760180912796_hgrc9gpe9', NULL, 'BN11316', 1, 1, 1, 61, 3, 87, '+880211911316', NULL, NULL, 'user11316@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$8sb10Cmez//jduGppaT5V.4aAuDFGY5ePJdXMhRzQsAq4hyap3VW.', NULL, 1, '2025-10-11 11:08:33', '2025-10-11 11:08:33'),
	(128, 'SO (Hydro)', 'user_1760180921098_ccx5weau8', NULL, 'BN20219', 1, 1, 1, 61, 3, 88, '+880211920219', NULL, NULL, 'user20219@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$gu9an6rGsYrQp/U8HftN/OFl06JJFmOVpZWPUNvuMJ1ei25dAf0oa', NULL, 1, '2025-10-11 11:08:41', '2025-10-11 11:08:41'),
	(129, 'Capt Staff', 'user_1760180942737_ss4nx5fgu', NULL, 'BN41487', 1, 1, 1, 62, 3, 89, '+880211941487', NULL, NULL, 'user41487@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$srLBJVhsSPecSEB7XyCw9eoC.IZQBNDy4gFngHUv6jpIDMgt4BEe2', NULL, 1, '2025-10-11 11:09:02', '2025-10-11 11:09:02'),
	(130, 'DD Sub', 'user_1760180955222_xelm61q2d', NULL, 'BN53215', 1, 1, 1, 62, 3, 90, '+880211953215', NULL, NULL, 'user53215@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$q7bs0uJw9nLrb7QG.fz/7uLxt5FSJjtws/PZCO2J6VDQRmY9JpO/6', NULL, 1, '2025-10-11 11:09:15', '2025-10-11 11:09:15'),
	(131, 'DD Sub (Tec)', 'user_1760180964475_iplgxyfxl', NULL, 'BN63620', 1, 1, 1, 62, 3, 91, '+880211963620', NULL, NULL, 'user63620@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$rRQ8XoeMNqIuE2unkH7rkeNEOlndOdPiYVysB3v8QMNN53vHGOQ/q', NULL, 1, '2025-10-11 11:09:24', '2025-10-11 11:09:24'),
	(132, 'So (Sub)', 'user_1760180976933_0sp1fhrtz', NULL, 'BN75148', 1, 1, 1, 62, 3, 92, '+880211975148', NULL, NULL, 'user75148@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$4KSQs3HdZ44Qi2TkuzaVLexDdxnZROKS//M7jQYlvwSLNhFG6CI/q', NULL, 1, '2025-10-11 11:09:37', '2025-10-11 11:09:37'),
	(133, 'DD Spl Ops', 'user_1760181000381_m8k30skmc', NULL, 'BN99476', 1, 1, 1, 63, 3, 93, '+880211999476', NULL, NULL, 'user99476@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$J3PrND1g2OKrez5YW0FNTOg6jz4RhBuhsoGQfpm1pXq3ymMdqOxym', NULL, 1, '2025-10-11 11:10:00', '2025-10-11 11:10:00'),
	(134, 'SO (Spl Ops)', 'user_1760181008283_f752d4gpu', NULL, 'BN7437', 1, 1, 1, 63, 3, 94, '+8802117437', NULL, NULL, 'user7437@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$RoBse2wvbUSLmbWF0WLnMOcIlBZo.a5G6QXPAeHYuCYBV17hhWp4W', NULL, 1, '2025-10-11 11:10:08', '2025-10-11 11:10:08'),
	(135, 'DD SD & C', 'user_1760181042250_8b2r4ixzr', NULL, 'BN40844', 1, 1, 1, 64, 3, 95, '+88021140844', NULL, NULL, 'user40844@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$n04DesYTwx1qQXl7jxpOjuz./BZuICshrIsQ/Z8k0tH3ZWmzhxxQu', NULL, 1, '2025-10-11 11:10:42', '2025-10-11 11:10:42'),
	(136, 'SO (SD & C)', 'user_1760181061561_ox8g3ct5w', NULL, 'BN60570', 1, 1, 1, 64, 3, 96, '+88021160570', NULL, NULL, 'user60570@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$cjk09rM3wrGzOD/d61tVk.YjBbh9Y6v7bCvgibhONehCXesl4PAQW', NULL, 1, '2025-10-11 11:11:01', '2025-10-11 11:11:01'),
	(137, 'ACNS (O)', 'user_1760186020587_4cmq9oe3q', NULL, 'BN19737', 1, 1, 1, 68, 3, 98, '+88021119737', NULL, NULL, 'user19737@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$q.H4Wf4VNm7bdXF1.OMFKe4uqoTcgGRrC7r90BpWekVstkhXMOsAK', NULL, 1, '2025-10-11 12:33:40', '2025-10-11 12:33:40'),
	(138, 'Coord to ACNS (O)', 'user_1760186029785_otr2ui7eh', NULL, 'BN28869', 1, 1, 1, 68, 3, 99, '+88021128869', NULL, NULL, 'user28869@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$wAHx6.orY836Ef007CYqJu9CTOMzed27UtzjYuCcfiy8JnuWpQEAC', NULL, 1, '2025-10-11 12:33:49', '2025-10-11 12:33:49'),
	(139, 'DDNO', 'user_1760186212955_15efnaeds', NULL, 'BN10944', 1, 1, 1, 69, 3, 100, '+880211210944', NULL, NULL, 'user10944@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$69cNbv0X51qgEF9Afqn6LOaokIlRct69YvDVmZWxnDFu2KX.WVQnC', NULL, 1, '2025-10-11 12:36:53', '2025-10-11 12:36:53'),
	(140, 'SO (O)', 'user_1760186219115_k5ll2mx29', NULL, 'BN18124', 1, 1, 1, 69, 3, 101, '+880211218124', NULL, NULL, 'user18124@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$4dZbgHGtajbsE.orgU6Heu50EeMsN7pAUBqsYVBV1aVjhXSibePui', NULL, 1, '2025-10-11 12:36:59', '2025-10-11 12:36:59'),
	(141, 'SO (Ops Plan)', 'user_1760186231732_kppiftdaf', NULL, 'BN26901', 1, 1, 1, 69, 3, 102, '+880211226901', NULL, NULL, 'user26901@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$3UJ.IZcDTtbUVSbwf68XqOfOWJw8xpcEildeUF4GRqSuJpVN2urPC', NULL, 1, '2025-10-11 12:37:11', '2025-10-11 12:37:11'),
	(142, 'DDNI', 'user_1760186644358_viszknyo3', NULL, 'BN41340', 1, 1, 1, 70, 3, 103, '+880211641340', NULL, NULL, 'user41340@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$HmaAVkvKqGzDGcP5OvTXKOcK7Mq3TlNaabFIORgXMJYWTFfjJzytW', NULL, 1, '2025-10-11 12:44:04', '2025-10-11 12:44:04'),
	(143, 'SO (I)', 'user_1760186653067_weghretz6', NULL, 'BN52080', 1, 1, 1, 70, 3, 104, '+880211652080', NULL, NULL, 'user52080@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$zPWOqoB4AHx31vVYSll4B.L44XuBXiJuqP2r7IBI4Eymq.niT0Z6y', NULL, 1, '2025-10-11 12:44:13', '2025-10-11 12:44:13'),
	(144, 'SO (Cl)', 'user_1760186658617_i4uu7ct0g', NULL, 'BN57588', 1, 1, 1, 70, 3, 105, '+880211657588', NULL, NULL, 'user57588@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$t32rC9BSxlLfZ3LPBGbhL.ru3YVS3P/jI87848yV82JSOTSFgvN9K', NULL, 1, '2025-10-11 12:44:18', '2025-10-11 12:44:18'),
	(145, 'SO (Tec)', 'user_1760186663646_b4vz0soen', NULL, 'BN62706', 1, 1, 1, 70, 3, 106, '+880211662706', NULL, NULL, 'user62706@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$WYAliHqNJybuSZhsM9NLAeOqhhTpYSLh5LZVpDca2SL33Z3ayet9K', NULL, 1, '2025-10-11 12:44:23', '2025-10-11 12:44:23'),
	(146, 'SO (Media)', 'user_1760186668116_p5x1pc7g3', NULL, 'BN67211', 1, 1, 1, 70, 3, 107, '+880211667211', NULL, NULL, 'user67211@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$aF70F/xPGnkRE.69osK5auOfNwO11Lxw/6zLNi32UD0TYlOtQ8yUq', NULL, 1, '2025-10-11 12:44:28', '2025-10-11 12:44:28'),
	(147, 'DDNP', 'user_1760186753012_32ac6vs9l', NULL, 'BN51983', 1, 1, 1, 71, 3, 108, '+880211751983', NULL, NULL, 'user51983@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$GEOxEnmp6ZLyUkNKrMtYZec3CsA3u5zLL854M2CkHhP0jZ9NtemMu', NULL, 1, '2025-10-11 12:45:53', '2025-10-11 12:45:53'),
	(148, 'SO (Plan-1)', 'user_1760186764491_m79kcsjqe', NULL, 'BN63377', 1, 1, 1, 71, 3, 109, '+880211763377', NULL, NULL, 'user63377@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$1XY6aHQpzIykUWbobq90POHfFk/w7gPJsY49HhP4FGjjHn1ZZct4.', NULL, 1, '2025-10-11 12:46:04', '2025-10-11 12:46:04'),
	(149, 'SO (Plans-2)', 'user_1760186772186_8q5nr69lk', NULL, 'BN71257', 1, 1, 1, 71, 3, 110, '+880211771257', NULL, NULL, 'user71257@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$mINOPd4l.eFECljRpK7O4eLHloXu2XuvonDU0bTv8NQnnrYR3C2i2', NULL, 1, '2025-10-11 12:46:12', '2025-10-11 12:46:12'),
	(150, 'DD Sig', 'user_1760186835934_nd86g7g0i', NULL, 'BN33995', 1, 1, 1, 72, 3, 111, '+880211833995', NULL, NULL, 'user33995@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$JGIH.CaOmW/.zdaH2rxEDec8qESe5U.MxMy1U4udp1X1oeMEwDgxC', NULL, 1, '2025-10-11 12:47:16', '2025-10-11 12:47:16'),
	(151, 'SO (Sig)', 'user_1760186845383_5e2s8jckt', NULL, 'BN42769', 1, 1, 1, 72, 3, 112, '+880211842769', NULL, NULL, 'user42769@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$BeQPcTQajYTvJbAqafSjH.HlVxDHpBzCEj4CSoOkmsvgHh5jcbuuy', NULL, 1, '2025-10-11 12:47:25', '2025-10-11 12:47:25'),
	(152, 'DD Works', 'user_1760186897492_3j00rd8y5', NULL, 'BN96217', 1, 1, 1, 73, 3, 113, '+880211896217', NULL, NULL, 'user96217@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$ySCvOU39bVvveXg2urrP9OsHCiC.ts3wYeKSMCWJ6vwpqBrZ/aBDe', NULL, 1, '2025-10-11 12:48:17', '2025-10-11 12:48:17'),
	(153, 'SO (Works)', 'user_1760186908062_m5a1xkiey', NULL, 'BN7110', 1, 1, 1, 73, 3, 114, '+880211907110', NULL, NULL, 'user7110@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$KYPllYFxE9FyL1vkJMIEOu9njzc8cd6YdwnEs5GBYk7E9r8Iszi/O', NULL, 1, '2025-10-11 12:48:28', '2025-10-11 12:48:28'),
	(154, 'DD Nav', 'user_1760186947152_mbhjp8z0o', NULL, 'BN46292', 1, 1, 1, 74, 3, 115, '+880211946292', NULL, NULL, 'user46292@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$ehleaVkpnA7z6OzJhGlD5eCHKAzmE3/WbLx2dZzuIn2AOcVd4mWvi', NULL, 1, '2025-10-11 12:49:07', '2025-10-11 12:49:07'),
	(155, 'SO (Nav)', 'user_1760186953771_jkv587zj4', NULL, 'BN52827', 1, 1, 1, 74, 3, 116, '+880211952827', NULL, NULL, 'user52827@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$fjuvOoQZO3h5C4ww1KXrh.2PJV.C4iFK9ryGeE9QCYRSxnL0W.2f2', NULL, 1, '2025-10-11 12:49:13', '2025-10-11 12:49:13'),
	(156, 'DD Hydro', 'user_1760186998566_p16trms93', NULL, 'BN97585', 1, 1, 1, 75, 3, 117, '+880211997585', NULL, NULL, 'user97585@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$QgBlDybohQnOWNZyiItWgO8YytoVJopzBZR2DY9EKvlhYtu2ZXZZW', NULL, 1, '2025-10-11 12:49:58', '2025-10-11 12:49:58'),
	(157, 'SO (Hydro)', 'user_1760187006095_6xvnv4l4r', NULL, 'BN4931', 1, 1, 1, 75, 3, 118, '+8802114931', NULL, NULL, 'user4931@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Aqm3aXIiariasrcoNi3YxuI7eEA7m9EhX/ocO.6Tbs2ImHxFBmS9e', NULL, 1, '2025-10-11 12:50:06', '2025-10-11 12:50:06'),
	(158, 'Capt Staff', 'user_1760187133172_51u7bovui', NULL, 'BN31615', 1, 1, 1, 76, 3, 119, '+880211131615', NULL, NULL, 'user31615@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$mGqcRI9YfMEeomTbQyG7ruFtgvIuyOzidwYChghcmD69.ywG1QKle', NULL, 1, '2025-10-11 12:52:13', '2025-10-11 12:52:13'),
	(159, 'DD Sub', 'user_1760187141122_rjglt6nw5', NULL, 'BN40182', 1, 1, 1, 76, 3, 120, '+880211140182', NULL, NULL, 'user40182@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$wFnZH.aFDbaNAItNbQxJXeXEOLX3MKiINnBBpySphnh1klYvNAipS', NULL, 1, '2025-10-11 12:52:21', '2025-10-11 12:52:21'),
	(160, 'DD Sub (Tec)', 'user_1760187149403_ynaptsz5g', NULL, 'BN48595', 1, 1, 1, 76, 3, 121, '+880211148595', NULL, NULL, 'user48595@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$9hW62fGiNFqEI9T1ZBWpYeIP8lWwfsoW2tUn80aeHIun9laO8ZPQK', NULL, 1, '2025-10-11 12:52:29', '2025-10-11 12:52:29'),
	(161, 'So (Sub)', 'user_1760187156190_fmh296fud', NULL, 'BN53662', 1, 1, 1, 76, 3, 122, '+880211153662', NULL, NULL, 'user53662@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$4QA65vMCKfxUPYdfnO6iDet0f1V4Ah0yq6OT1b1/.1RjtSbhsBIDK', NULL, 1, '2025-10-11 12:52:36', '2025-10-11 12:52:36'),
	(162, 'DD Spl Ops', 'user_1760187219405_y243j1vd5', NULL, 'BN17574', 1, 1, 1, 77, 3, 123, '+880211217574', NULL, NULL, 'user17574@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$tzeROYZnu2nPBdGoVbZGQedS9o3VLAD6HOaY6BK51wDYUURpL1qsa', NULL, 1, '2025-10-11 12:53:39', '2025-10-11 12:53:39'),
	(163, 'SO (Spl Ops)', 'user_1760187226320_2guc699n8', NULL, 'BN25452', 1, 1, 1, 77, 3, 124, '+880211225452', NULL, NULL, 'user25452@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$.8gT485yXdS4rBFDJduv1.lK5DLckr0lXdrfglpwgg.BxjT8WL9Fi', NULL, 1, '2025-10-11 12:53:46', '2025-10-11 12:53:46'),
	(164, 'DD SD & C', 'user_1760187305370_m1htdfprj', NULL, 'BN94503', 1, 1, 1, 78, 3, 125, '+880211294503', NULL, NULL, 'user94503@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$9Ol0OR62laS.BtcObYRfBulU5EnWT3nEQLTZbwdnLBcIDFpoKVZBa', NULL, 1, '2025-10-11 12:55:05', '2025-10-11 12:55:05'),
	(165, 'SO (SD & C)', 'user_1760187314464_9vhv745jz', NULL, 'BN10973', 1, 1, 1, 78, 3, 126, '+880211310973', NULL, NULL, 'user10973@navy.mil.bd', NULL, 'offline', NULL, '$2a$12$Wb.kQVB9eKMVl5.PsUI6/OtOjwjB6gGu33ALu/pSz8npaxzREIm52', NULL, 1, '2025-10-11 12:55:14', '2025-10-11 12:55:14');

-- Dumping structure for table cms_db.user_permissions
CREATE TABLE IF NOT EXISTS `user_permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `permission_id` int(11) NOT NULL,
  `granted_by` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_permission` (`user_id`,`permission_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_permission_id` (`permission_id`),
  KEY `idx_granted_by` (`granted_by`),
  CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_permissions_ibfk_3` FOREIGN KEY (`granted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.user_permissions: ~0 rows (approximately)

-- Dumping structure for table cms_db.user_preferences
CREATE TABLE IF NOT EXISTS `user_preferences` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `preference_key` varchar(100) NOT NULL,
  `preference_value` text DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_preference` (`user_id`,`preference_key`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_preference_key` (`preference_key`),
  CONSTRAINT `user_preferences_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.user_preferences: ~0 rows (approximately)

-- Dumping structure for table cms_db.user_sessions
CREATE TABLE IF NOT EXISTS `user_sessions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `session_token` varchar(255) NOT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `expires_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `session_token` (`session_token`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_session_token` (`session_token`),
  KEY `idx_expires_at` (`expires_at`),
  CONSTRAINT `user_sessions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table cms_db.user_sessions: ~0 rows (approximately)

-- Dumping structure for view cms_db.user_statistics
-- Creating temporary table to overcome VIEW dependency errors
CREATE TABLE `user_statistics` (
	`total_users` BIGINT(21) NOT NULL,
	`online_users` BIGINT(21) NOT NULL,
	`offline_users` BIGINT(21) NOT NULL,
	`busy_users` BIGINT(21) NOT NULL,
	`super_admins` BIGINT(21) NOT NULL,
	`admins` BIGINT(21) NOT NULL,
	`regular_users` BIGINT(21) NOT NULL
);

-- Dumping structure for trigger cms_db.log_user_update
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `log_user_update` AFTER UPDATE ON `users` FOR EACH ROW BEGIN
    IF (OLD.name != NEW.name) OR (OLD.email != NEW.email) OR (OLD.phone != NEW.phone) THEN
        INSERT INTO audit_logs (user_id, action, target_type, target_id, target_name, details)
        VALUES (NEW.id, 'USER_UPDATED', 'user', NEW.id, NEW.name,
                CONCAT(
                    CASE WHEN OLD.name != NEW.name THEN CONCAT('name from \"', OLD.name, '\" to \"', NEW.name, '\"; ') ELSE '' END,
                    CASE WHEN OLD.email != NEW.email THEN CONCAT('email from \"', OLD.email, '\" to \"', NEW.email, '\"; ') ELSE '' END,
                    CASE WHEN OLD.phone != NEW.phone THEN CONCAT('phone from \"', OLD.phone, '\" to \"', NEW.phone, '\";') ELSE '' END
                ));
    END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;

-- Dumping structure for trigger cms_db.update_last_seen_on_status_change
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `update_last_seen_on_status_change` BEFORE UPDATE ON `users` FOR EACH ROW BEGIN
    IF NEW.status = 'online' AND OLD.status != 'online' THEN
        SET NEW.last_seen = CURRENT_TIMESTAMP;
    END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `conversation_summary`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `conversation_summary` AS select `c`.`id` AS `id`,`c`.`type` AS `type`,`c`.`name` AS `name`,count(distinct `cp`.`user_id`) AS `participant_count`,count(`m`.`id`) AS `message_count`,max(`m`.`created_at`) AS `last_message_at`,`c`.`created_at` AS `created_at`,`c`.`updated_at` AS `updated_at` from ((`conversations` `c` left join `conversation_participants` `cp` on((`c`.`id` = `cp`.`conversation_id`))) left join `messages` `m` on((`c`.`id` = `m`.`conversation_id`))) group by `c`.`id`,`c`.`type`,`c`.`name`,`c`.`created_at`,`c`.`updated_at` 
;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `message_statistics`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `message_statistics` AS select cast(`messages`.`created_at` as date) AS `message_date`,count(0) AS `total_messages`,count((case when (`messages`.`type` = 'text') then 1 end)) AS `text_messages`,count((case when (`messages`.`type` = 'system') then 1 end)) AS `system_messages`,count(distinct `messages`.`sender_id`) AS `unique_senders` from `messages` group by cast(`messages`.`created_at` as date) 
;

-- Removing temporary table and create final VIEW structure
DROP TABLE IF EXISTS `user_statistics`;
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `user_statistics` AS select count(0) AS `total_users`,count((case when (`users`.`status` = 'online') then 1 end)) AS `online_users`,count((case when (`users`.`status` = 'offline') then 1 end)) AS `offline_users`,count((case when (`users`.`status` = 'busy') then 1 end)) AS `busy_users`,count((case when (`users`.`role_id` = 1) then 1 end)) AS `super_admins`,count((case when (`users`.`role_id` = 2) then 1 end)) AS `admins`,count((case when (`users`.`role_id` = 3) then 1 end)) AS `regular_users` from `users` where (`users`.`is_active` = true) 
;

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
