-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 07, 2026 at 12:18 PM
-- Server version: 11.4.12-MariaDB-cll-lve
-- PHP Version: 8.4.24

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `sosmthhg_staging`
--

-- --------------------------------------------------------

--
-- Table structure for table `equipment`
--

CREATE TABLE `equipment` (
  `id` int(10) UNSIGNED NOT NULL,
  `organization_unit` varchar(8) DEFAULT NULL,
  `user_id` int(10) UNSIGNED DEFAULT NULL,
  `is_in_warehouse` tinyint(1) NOT NULL DEFAULT 0,
  `asset_type` enum('Laptop','Telefon','Monitor','Docking station','Tablet','Ostalo') NOT NULL DEFAULT 'Laptop',
  `asset_name` varchar(160) NOT NULL,
  `serial_no` varchar(120) DEFAULT NULL,
  `inventory_no` varchar(120) DEFAULT NULL,
  `assigned_at` date DEFAULT NULL,
  `status` enum('assigned','returned','repair','retired') NOT NULL DEFAULT 'assigned',
  `notes` text DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `equipment`
--

INSERT INTO `equipment` (`id`, `organization_unit`, `user_id`, `is_in_warehouse`, `asset_type`, `asset_name`, `serial_no`, `inventory_no`, `assigned_at`, `status`, `notes`, `created_at`, `updated_at`) VALUES
(1, 'F', 9, 0, 'Laptop', 'HP ELITE 650', '3107FA82828', '512888r', '2026-05-11', 'repair', NULL, '2026-05-12 13:35:48', '2026-08-10 14:10:20'),
(2, 'F', 8, 0, 'Laptop', 'HP ELITEOBOK', '31818', '3178f17af', '2026-07-10', 'repair', 'Ispravno stanje', '2026-07-10 17:22:21', '2026-08-10 14:11:37'),
(3, 'F', 3, 0, 'Telefon', 'Honor', '3107FAFA', '3107FEQ1818', '2026-07-09', 'assigned', 'Dat je punjac.', '2026-07-10 18:07:34', '2026-07-10 18:07:34'),
(4, 'F', 6, 0, 'Laptop', 'HP EliteBook 850 G8', '3107FHW000053', '5CG1354QRL', '2021-11-03', 'assigned', 'Uz laptop je dat punjač.', '2026-07-30 21:25:18', '2026-07-30 21:25:18'),
(5, 'F', 6, 0, 'Telefon', 'Samsung A34 5G', '350042730855697', '3107FEQ000094', '2025-07-07', 'assigned', 'Uz telefon je data kutija i punjač (data kabl).', '2026-07-30 21:30:13', '2026-07-30 21:30:13'),
(6, 'F', 3, 0, 'Monitor', 'test', 'tata', 'tata', '2026-08-20', 'assigned', 'teaa', '2026-08-20 20:59:50', '2026-08-20 20:59:50'),
(7, 'F', NULL, 1, 'Docking station', 'HP DOCKING', '2299', '31556', NULL, 'returned', 'Docking je ispravan. Testiran', '2026-08-20 21:53:12', '2026-08-23 18:05:46'),
(9, 'DS', NULL, 1, 'Laptop', 'teata', '3107FATEST123', '3107FATEST123', NULL, 'returned', 'Test opprema', '2026-08-23 18:06:17', '2026-08-23 18:06:17');

-- --------------------------------------------------------

--
-- Table structure for table `equipment_assignment_events`
--

CREATE TABLE `equipment_assignment_events` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `equipment_id` int(10) UNSIGNED NOT NULL,
  `old_user_id` int(10) UNSIGNED DEFAULT NULL,
  `old_user_name` varchar(160) DEFAULT NULL,
  `new_user_id` int(10) UNSIGNED DEFAULT NULL,
  `new_user_name` varchar(160) DEFAULT NULL,
  `old_is_in_warehouse` tinyint(1) NOT NULL DEFAULT 0,
  `new_is_in_warehouse` tinyint(1) NOT NULL DEFAULT 0,
  `changed_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `equipment_assignment_events`
--

INSERT INTO `equipment_assignment_events` (`id`, `equipment_id`, `old_user_id`, `old_user_name`, `new_user_id`, `new_user_name`, `old_is_in_warehouse`, `new_is_in_warehouse`, `changed_by`, `created_at`) VALUES
(1, 7, NULL, NULL, NULL, NULL, 0, 1, 1, '2026-08-20 21:53:12'),
(2, 7, NULL, NULL, 3, 'Test Testic', 1, 0, 1, '2026-08-20 22:02:10'),
(3, 7, 3, 'Test Testic', NULL, NULL, 0, 1, 1, '2026-08-21 09:28:01'),
(5, 9, NULL, NULL, NULL, NULL, 0, 1, 1, '2026-08-23 18:06:17');

-- --------------------------------------------------------

--
-- Table structure for table `equipment_audit_events`
--

CREATE TABLE `equipment_audit_events` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `equipment_id` int(10) UNSIGNED DEFAULT NULL,
  `actor_user_id` int(10) UNSIGNED DEFAULT NULL,
  `action` varchar(64) NOT NULL,
  `old_value` longtext DEFAULT NULL,
  `new_value` longtext DEFAULT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `equipment_audit_events`
--

INSERT INTO `equipment_audit_events` (`id`, `equipment_id`, `actor_user_id`, `action`, `old_value`, `new_value`, `created_at`) VALUES
(1, 7, 1, 'updated', '{\"organization_unit\":null,\"inventory_no\":\"31556\",\"asset_type\":\"Docking station\",\"asset_name\":\"HP DOCKING\",\"serial_no\":\"2299\",\"status\":\"returned\",\"notes\":\"Docking je ispravan. Testiran\"}', '{\"organization_unit\":\"F\",\"inventory_no\":\"31556\",\"asset_type\":\"Docking station\",\"asset_name\":\"HP DOCKING\",\"serial_no\":\"2299\",\"status\":\"returned\",\"notes\":\"Docking je ispravan. Testiran\"}', '2026-08-23 18:05:46'),
(2, 7, 1, 'organization_unit_changed', NULL, 'F', '2026-08-23 18:05:46'),
(3, 9, 1, 'created', NULL, '{\"organization_unit\":\"DS\",\"user_id\":null,\"inventory_no\":\"3107FATEST123\",\"asset_type\":\"Laptop\",\"asset_name\":\"teata\"}', '2026-08-23 18:06:17');

-- --------------------------------------------------------

--
-- Table structure for table `login_attempts`
--

CREATE TABLE `login_attempts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `email_hash` char(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
  `ip_hash` char(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
  `attempted_at` datetime NOT NULL,
  `success` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `login_attempts`
--

INSERT INTO `login_attempts` (`id`, `email_hash`, `ip_hash`, `attempted_at`, `success`) VALUES
(1, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:57:22', 1),
(2, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:58:36', 1),
(3, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:29', 0),
(4, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:31', 0),
(5, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:33', 0),
(6, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:35', 0),
(7, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:37', 0),
(8, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:39', 0),
(9, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:42', 0),
(10, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 14:59:45', 0),
(11, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:00:02', 0),
(12, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:00:06', 0),
(13, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:00:49', 1),
(14, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:20:15', 1),
(15, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:20:37', 0),
(16, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:24:25', 0),
(17, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:28:16', 1),
(18, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 15:37:18', 1),
(19, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 16:43:07', 0),
(20, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 16:43:12', 1),
(21, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 17:19:29', 1),
(22, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 17:21:29', 1),
(23, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 17:22:10', 1),
(24, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 17:24:15', 1),
(25, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 17:33:55', 1),
(26, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:05:20', 1),
(27, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:07:32', 1),
(28, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:07:59', 1),
(29, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:09:29', 1),
(30, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:10:44', 1),
(31, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:15:18', 1),
(32, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:20:37', 1),
(33, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', '4d3bb07f4e1b18c3e67ffde275347fa726647809208026e66f568258614d38f5', '2026-08-23 18:23:00', 1),
(34, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'd602538faebad251bfc28d9b9c3f469541dd308cba559cf65946e3cff98edba0', '2026-08-24 08:11:05', 1),
(35, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'd602538faebad251bfc28d9b9c3f469541dd308cba559cf65946e3cff98edba0', '2026-08-24 09:26:42', 0),
(36, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', 'd602538faebad251bfc28d9b9c3f469541dd308cba559cf65946e3cff98edba0', '2026-08-24 10:56:08', 1),
(37, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:04:17', 0),
(38, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:04:25', 0),
(39, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:05:19', 0),
(40, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:05:21', 0),
(41, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:06:39', 0),
(42, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:06:47', 0),
(43, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-26 12:08:32', 1),
(44, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 19:12:00', 1),
(45, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 19:36:44', 1),
(46, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 20:05:51', 0),
(47, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 20:05:57', 1),
(48, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 20:16:49', 0),
(49, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 20:16:54', 0),
(50, 'bc6cffab0519aff34ebee5ca89ccf518e01ffde5c0de78c78dfab77de8c65442', 'c3823e48047c859d70b7d96b5f3b57a63f98dcb2e54e62c461489655d78a1afe', '2026-08-26 20:17:00', 1),
(51, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '34ed44921fccb0dc7a1356c94a01df8559d9efe49af6787c3881285ad5a2812e', '2026-08-27 08:11:19', 1),
(52, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-28 18:11:15', 1),
(53, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-28 19:29:23', 1),
(54, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-28 19:31:10', 1),
(55, '5fc91251cb2a804ecd912a563392dc22c98557aa440939423d78b8ac5e0d39eb', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-28 19:31:13', 0),
(56, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-29 01:18:25', 1),
(57, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-29 08:51:25', 1),
(58, 'dbbddddf8fd37b6274ea85c3ea80c1b22ed613f201953a3748aa36e255d2455d', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-29 15:31:58', 0),
(59, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-30 13:19:07', 1),
(60, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-08-30 19:25:39', 1),
(61, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-30 19:59:30', 1),
(62, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 22:20:53', 1),
(63, '83d51e26ac5a88f98abd53b4bff70890cc13649f5099581a1fc7831705505fc6', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 22:44:24', 0),
(64, '83d51e26ac5a88f98abd53b4bff70890cc13649f5099581a1fc7831705505fc6', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 22:44:29', 0),
(65, '83d51e26ac5a88f98abd53b4bff70890cc13649f5099581a1fc7831705505fc6', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 22:44:35', 1),
(66, 'fe956dea834dfc61d0425f4f1f29685c5905f7e63f7b9d517edaf3f35b0d72c0', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 23:15:43', 1),
(67, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 23:20:15', 1),
(68, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', 'eac6ecd8bfbd4b3457e0f02d3fbcca0e1000b2699ec8a3cfc941726a83c6cf8e', '2026-08-31 23:32:18', 1),
(69, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', 'f938a01ceebcb68dde0b01c9fc97de7f72e9de119eaafa7d73d0ac761e55cccf', '2026-09-01 21:01:14', 1),
(70, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', '5ed98ec112909e98726c310c894069285e749c293b87c4ed5ac744b707b10500', '2026-09-03 19:20:39', 1),
(71, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '2768d831095dcd7a0c19b526ec8a19905552198f813180a1c3c0476b72d36edf', '2026-09-03 20:37:50', 1),
(72, 'f0f34dcaa5c352e89465e8f482f440e1ba6045cfe4835134bbdebf377cdcaa24', '2768d831095dcd7a0c19b526ec8a19905552198f813180a1c3c0476b72d36edf', '2026-09-03 20:41:45', 1),
(73, 'dbbddddf8fd37b6274ea85c3ea80c1b22ed613f201953a3748aa36e255d2455d', '2768d831095dcd7a0c19b526ec8a19905552198f813180a1c3c0476b72d36edf', '2026-09-03 22:10:04', 0),
(74, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', '5ed98ec112909e98726c310c894069285e749c293b87c4ed5ac744b707b10500', '2026-09-03 22:49:21', 1),
(75, '90ea8a24bac20ac7d593c4011ff4fe070a937717539fd953ee6f0cab2e89f6e9', '5ed98ec112909e98726c310c894069285e749c293b87c4ed5ac744b707b10500', '2026-09-07 15:21:51', 1);

-- --------------------------------------------------------

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `title` varchar(160) NOT NULL,
  `message` varchar(500) NOT NULL,
  `link_url` varchar(255) DEFAULT NULL,
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `read_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `user_id`, `title`, `message`, `link_url`, `is_read`, `created_at`, `read_at`) VALUES
(1, 1, 'Dodeljena vam je oprema', 'Laptop: HP ELITE 650 je evidentiran kao vaša oprema.', 'dashboard.php', 1, '2026-05-12 13:35:48', '2026-05-12 13:38:26'),
(2, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-12 13:36:03', '2026-05-12 13:38:26'),
(3, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-12 20:48:42', '2026-05-12 20:49:09'),
(4, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-12 20:48:51', '2026-05-12 20:49:09'),
(5, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-12 20:48:56', '2026-05-12 20:49:09'),
(6, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-12 20:49:01', '2026-05-12 20:49:09'),
(10, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-19 15:44:25', '2026-05-19 15:44:41'),
(11, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-19 15:45:10', '2026-05-19 15:45:19'),
(12, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-19 15:46:29', '2026-05-19 15:46:32'),
(13, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-05-19 15:47:09', '2026-05-19 15:47:13'),
(14, 1, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-06-09 13:11:55', '2026-06-09 13:12:16'),
(15, 1, 'Lozinka je promenjena', 'Lozinka za vaš nalog je uspešno promenjena.', 'account.php#password', 1, '2026-07-09 11:31:00', '2026-07-10 15:41:46'),
(16, 1, 'Novi zahtev SOS-20260710-16005', 'Test Testic je prijavio/la zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-10 17:11:27', '2026-07-10 17:15:15'),
(17, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: U obradi, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-10 17:13:11', '2026-07-10 17:13:18'),
(18, 3, 'Nova dopuna zahteva SOS-20260710-16005', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-10 17:14:04', '2026-07-10 17:14:15'),
(19, 1, 'Nova dopuna zahteva SOS-20260710-16005', 'Test Testic je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-10 17:15:09', '2026-07-10 17:15:15'),
(20, 1, 'Nova dopuna zahteva SOS-20260710-16005', 'Test Testic je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-10 17:15:09', '2026-07-10 17:15:15'),
(21, 3, 'Dodeljena vam je oprema', 'Laptop: HP ELITEOBOK je evidentiran kao vaša oprema.', 'dashboard.php', 1, '2026-07-10 17:22:21', '2026-07-10 17:22:36'),
(22, 3, 'Ažurirana je vaša oprema', 'Laptop: HP ELITEOBOK je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-07-10 18:03:58', '2026-07-10 18:04:07'),
(23, 3, 'Dodeljena vam je oprema', 'Telefon: Honor je evidentiran kao vaša oprema.', 'dashboard.php', 1, '2026-07-10 18:07:34', '2026-07-10 18:07:40'),
(24, 1, 'Nova dopuna zahteva SOS-20260710-16005', 'Test Testic je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-12 10:18:23', '2026-07-12 10:19:05'),
(25, 1, 'Nova dopuna zahteva SOS-20260710-16005', 'Test Testic je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-12 10:18:23', '2026-07-12 10:19:13'),
(26, 3, 'Nova dopuna zahteva SOS-20260710-16005', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-12 10:19:27', '2026-07-12 10:20:02'),
(27, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: Na čekanju, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:19:57', '2026-07-12 10:20:02'),
(28, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: Rešen, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:20:08', '2026-07-12 10:20:14'),
(29, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: Zatvoren, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:20:24', '2026-07-12 10:20:32'),
(30, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: Rešen, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:21:24', '2026-07-12 10:22:27'),
(31, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: Zatvoren, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:22:07', '2026-07-12 10:22:27'),
(32, 1, 'Nova dopuna zahteva SOS-20260710-16005', 'Test Testic je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija Zatvoreni tiket je automatski ponovo otvoren.', 'ticket_view.php?id=9', 1, '2026-07-12 10:29:54', '2026-07-12 10:59:57'),
(33, 1, 'Nova dopuna zahteva SOS-20260710-16005', 'Test Testic je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija Zatvoreni tiket je automatski ponovo otvoren.', 'ticket_view.php?id=9', 1, '2026-07-12 10:29:54', '2026-07-12 10:59:57'),
(34, 3, 'Nova dopuna zahteva SOS-20260710-16005', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Moja kancelarija', 'ticket_view.php?id=9', 1, '2026-07-12 10:30:27', '2026-07-12 10:30:55'),
(35, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: U obradi, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:30:34', '2026-07-12 10:30:55'),
(36, 3, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260710-16005 je ažuriran. Status: Zatvoren, prioritet: Nizak.', 'ticket_view.php?id=9', 1, '2026-07-12 10:31:05', '2026-07-12 10:31:15'),
(49, 6, 'Dodeljena vam je oprema', 'Laptop: HP EliteBook 850 G8 je evidentiran kao vaša oprema.', 'dashboard.php', 1, '2026-07-30 21:25:18', '2026-07-31 09:45:19'),
(50, 6, 'Dodeljena vam je oprema', 'Telefon: Samsung A34 5G je evidentiran kao vaša oprema.', 'dashboard.php', 1, '2026-07-30 21:30:13', '2026-07-31 09:45:19'),
(51, 6, 'Nova dopuna zahteva SOS-20260731-24487', 'Maja Pantic je dodao/la komentar ili prilog na zahtev: Službeni prostor i oprema u prostoru — Suturen -magacinski prostor', 'ticket_view.php?id=12', 0, '2026-07-31 11:41:55', NULL),
(52, 6, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260731-24487 je ažuriran. Status: U obradi, prioritet: Hitno.', 'ticket_view.php?id=12', 1, '2026-07-31 11:42:09', '2026-07-31 11:42:42'),
(53, 1, 'Novi zahtev SOS-20260731-16458', 'Boris Djordjevic je prijavio/la zahtev: ICT oprema — Kancelarija', 'ticket_view.php?id=13', 1, '2026-07-31 12:19:11', '2026-07-31 12:21:14'),
(54, 7, 'Dodati ste kao učesnik', 'Boris Djordjevic vas je dodao/la kao učesnika na zahtev SOS-20260731-16458: ICT oprema — Kancelarija', 'ticket_view.php?id=13', 0, '2026-07-31 12:19:11', NULL),
(55, 6, 'Dodati ste kao učesnik', 'Boris Djordjevic vas je dodao/la kao učesnika na zahtev SOS-20260731-16458: ICT oprema — Kancelarija', 'ticket_view.php?id=13', 0, '2026-07-31 12:19:11', NULL),
(56, 5, 'Nova dopuna zahteva SOS-20260731-16458', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Kancelarija', 'ticket_view.php?id=13', 1, '2026-07-31 12:21:03', '2026-07-31 12:23:10'),
(57, 6, 'Nova dopuna zahteva SOS-20260731-16458', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Kancelarija', 'ticket_view.php?id=13', 0, '2026-07-31 12:21:03', NULL),
(58, 7, 'Nova dopuna zahteva SOS-20260731-16458', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Kancelarija', 'ticket_view.php?id=13', 0, '2026-07-31 12:21:03', NULL),
(60, 5, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260731-16458 je ažuriran. Status: U obradi, prioritet: Hitno.', 'ticket_view.php?id=13', 1, '2026-07-31 12:21:11', '2026-07-31 12:23:29'),
(61, 6, 'Promenjen status zahteva SOS-20260731-16458', 'dima je promenio/la status zahteva SOS-20260731-16458 sa „Otvoren” na „U obradi”.', 'ticket_view.php?id=13', 0, '2026-07-31 12:21:11', NULL),
(62, 7, 'Promenjen status zahteva SOS-20260731-16458', 'dima je promenio/la status zahteva SOS-20260731-16458 sa „Otvoren” na „U obradi”.', 'ticket_view.php?id=13', 0, '2026-07-31 12:21:11', NULL),
(64, 5, 'Novi zahtev SOS-20260731-37715', 'dima je prijavio/la zahtev: Službena vozila — Fiat 500L', 'ticket_view.php?id=14', 1, '2026-07-31 12:24:36', '2026-07-31 12:31:04'),
(65, 6, 'Dodati ste kao učesnik', 'dima vas je dodao/la kao učesnika na zahtev SOS-20260731-37715: Službena vozila — Fiat 500L', 'ticket_view.php?id=14', 0, '2026-07-31 12:24:36', NULL),
(66, 1, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260731-37715 je ažuriran. Status: U obradi, prioritet: Visok.', 'ticket_view.php?id=14', 1, '2026-07-31 12:26:58', '2026-07-31 13:11:31'),
(67, 6, 'Promenjen status zahteva SOS-20260731-37715', 'Boris Djordjevic je promenio/la status zahteva SOS-20260731-37715 sa „Otvoren” na „U obradi”.', 'ticket_view.php?id=14', 0, '2026-07-31 12:26:58', NULL),
(68, 1, 'Nova dopuna zahteva SOS-20260731-37715', 'Boris Djordjevic je dodao/la komentar ili prilog na zahtev: Službena vozila — Fiat 500L', 'ticket_view.php?id=14', 1, '2026-07-31 12:28:16', '2026-07-31 12:28:38'),
(69, 6, 'Nova dopuna zahteva SOS-20260731-37715', 'Boris Djordjevic je dodao/la komentar ili prilog na zahtev: Službena vozila — Fiat 500L', 'ticket_view.php?id=14', 0, '2026-07-31 12:28:16', NULL),
(70, 5, 'Nova dopuna zahteva SOS-20260731-37715', 'dima je dodao/la komentar ili prilog na zahtev: Službena vozila — Fiat 500L', 'ticket_view.php?id=14', 1, '2026-07-31 12:28:53', '2026-07-31 12:31:02'),
(71, 6, 'Nova dopuna zahteva SOS-20260731-37715', 'dima je dodao/la komentar ili prilog na zahtev: Službena vozila — Fiat 500L', 'ticket_view.php?id=14', 1, '2026-07-31 12:28:53', '2026-07-31 12:46:39'),
(72, 7, 'Nova dopuna zahteva SOS-20260731-24487', 'Vesna Lekic je dodao/la komentar ili prilog na zahtev: Službeni prostor i oprema u prostoru — Suturen -magacinski prostor', 'ticket_view.php?id=12', 0, '2026-08-03 10:45:16', NULL),
(73, 1, 'Novi zahtev SOS-20260810-12824', 'Vesna Lekic je prijavio/la zahtev: ICT oprema — Kraljevo', 'ticket_view.php?id=15', 1, '2026-08-10 13:27:22', '2026-08-10 13:29:14'),
(74, 7, 'Nova dopuna zahteva SOS-20260731-24487', 'Vesna Lekic je dodao/la komentar ili prilog na zahtev: Službeni prostor i oprema u prostoru — Suturen -magacinski prostor', 'ticket_view.php?id=12', 0, '2026-08-10 13:28:34', NULL),
(75, 6, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260810-12824 je ažuriran. Status: U obradi, prioritet: Hitno.', 'ticket_view.php?id=15', 0, '2026-08-10 13:29:57', NULL),
(76, 6, 'Nova dopuna zahteva SOS-20260810-12824', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema — Kraljevo', 'ticket_view.php?id=15', 0, '2026-08-10 13:30:00', NULL),
(77, 7, 'Novi zahtev SOS-20260810-26850', 'Tamara Premovic je prijavio/la zahtev: Službeni prostor i oprema u prostoru', 'ticket_view.php?id=16', 0, '2026-08-10 13:55:48', NULL),
(78, 1, 'Novi zahtev SOS-20260810-15011', 'Kristina Nedeljkovic je prijavio/la zahtev: ICT oprema', 'ticket_view.php?id=17', 1, '2026-08-10 13:56:03', '2026-08-10 13:58:36'),
(79, 9, 'Dodati ste kao učesnik', 'Tamara Premovic vas je dodao/la kao učesnika na zahtev SOS-20260810-26850: Službeni prostor i oprema u prostoru', 'ticket_view.php?id=16', 1, '2026-08-10 13:56:23', '2026-08-10 13:56:36'),
(80, 8, 'Dodati ste kao učesnik', 'Kristina Nedeljkovic vas je dodao/la kao učesnika na zahtev SOS-20260810-15011: ICT oprema', 'ticket_view.php?id=17', 1, '2026-08-10 13:57:14', '2026-08-10 13:57:32'),
(81, 9, 'Nova dopuna zahteva SOS-20260810-15011', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema', 'ticket_view.php?id=17', 1, '2026-08-10 13:58:50', '2026-08-10 13:59:53'),
(82, 8, 'Nova dopuna zahteva SOS-20260810-15011', 'dima je dodao/la komentar ili prilog na zahtev: ICT oprema', 'ticket_view.php?id=17', 1, '2026-08-10 13:58:50', '2026-08-10 13:59:45'),
(83, 8, 'Nova dopuna zahteva SOS-20260810-26850', 'dima je dodao/la komentar ili prilog na zahtev: Službeni prostor i oprema u prostoru', 'ticket_view.php?id=16', 1, '2026-08-10 13:59:35', '2026-08-10 14:00:05'),
(84, 7, 'Nova dopuna zahteva SOS-20260810-26850', 'dima je dodao/la komentar ili prilog na zahtev: Službeni prostor i oprema u prostoru', 'ticket_view.php?id=16', 0, '2026-08-10 13:59:35', NULL),
(85, 9, 'Nova dopuna zahteva SOS-20260810-26850', 'dima je dodao/la komentar ili prilog na zahtev: Službeni prostor i oprema u prostoru', 'ticket_view.php?id=16', 1, '2026-08-10 13:59:35', '2026-08-10 14:00:02'),
(86, 8, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260810-26850 je ažuriran. Status: U obradi, prioritet: Nizak.', 'ticket_view.php?id=16', 1, '2026-08-10 14:00:12', '2026-08-10 14:05:27'),
(87, 9, 'Promenjen status zahteva SOS-20260810-26850', 'dima je promenio/la status zahteva SOS-20260810-26850 sa „Otvoren” na „U obradi”.', 'ticket_view.php?id=16', 1, '2026-08-10 14:00:12', '2026-08-10 14:05:24'),
(88, 9, 'Ažuriran je vaš zahtev', 'Zahtev SOS-20260810-15011 je ažuriran. Status: U obradi, prioritet: Nizak.', 'ticket_view.php?id=17', 1, '2026-08-10 14:00:17', '2026-08-10 14:00:26'),
(89, 8, 'Promenjen status zahteva SOS-20260810-15011', 'dima je promenio/la status zahteva SOS-20260810-15011 sa „Otvoren” na „U obradi”.', 'ticket_view.php?id=17', 1, '2026-08-10 14:00:17', '2026-08-10 14:00:29'),
(90, 8, 'Ažurirana je vaša oprema', 'Laptop: HP ELITEOBOK je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-08-10 14:09:58', '2026-08-10 14:10:26'),
(91, 9, 'Ažurirana je vaša oprema', 'Laptop: HP ELITE 650 je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-08-10 14:10:20', '2026-08-10 14:10:53'),
(92, 8, 'Ažurirana je vaša oprema', 'Laptop: HP ELITEOBOK je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-08-10 14:11:37', '2026-08-10 14:11:47'),
(93, 1, 'Novi zahtev SOS-20260810-13710', 'Tamara Premovic je prijavio/la zahtev: ICT oprema', 'ticket_view.php?id=18', 1, '2026-08-10 14:11:37', '2026-08-12 09:14:53'),
(95, 3, 'Dodeljena vam je oprema', 'Monitor: test je evidentiran kao vaša oprema.', 'dashboard.php', 1, '2026-08-20 20:59:50', '2026-08-20 22:03:11'),
(96, 3, 'Ažurirana je vaša oprema', 'Docking station: HP DOCKING je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-08-20 22:02:10', '2026-08-20 22:03:11'),
(97, 3, 'Ažurirana je vaša oprema', 'Docking station: HP DOCKING je ažuriran u evidenciji.', 'dashboard.php', 1, '2026-08-20 22:02:37', '2026-08-20 22:03:11'),
(127, 5, 'Novi zahtev SOS-20260831-32520', 'TestZaposleni je prijavio/la zahtev: Službena vozila', 'ticket_view.php?id=20', 0, '2026-08-31 22:53:28', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `role_code` varchar(16) NOT NULL,
  `name` varchar(120) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(11) NOT NULL DEFAULT 100,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `role_code`, `name`, `description`, `is_active`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 'USERF', 'Zaposleni — Fondacija', 'Kreiranje i praćenje sopstvenih zahteva — Fondacija', 1, 10, '2026-07-26 14:23:23', '2026-08-18 16:40:54'),
(2, 'OFCF', 'Koordinator službenog prostora i opreme — Fondacija', 'Obrada zahteva za službeni prostor i opremu u prostoru — Fondacija', 1, 20, '2026-07-26 14:23:23', '2026-08-18 16:11:28'),
(3, 'VHCF', 'Koordinator službenih vozila — Fondacija', 'Obrada zahteva za službena vozila — Fondacija', 1, 30, '2026-07-26 14:23:23', '2026-08-18 16:11:28'),
(4, 'ICTF', 'ICT podrška — Fondacija', 'Obrada zahteva za ICT opremu — Fondacija', 1, 40, '2026-07-26 14:23:23', '2026-08-18 16:11:28'),
(5, 'OTHF', 'Koordinator za razvrstavanje zahteva — Fondacija', 'Razvrstavanje zahteva iz kategorije Ostalo — Fondacija', 1, 50, '2026-07-26 14:23:23', '2026-08-18 16:11:28'),
(6, 'USERDS', 'Zaposleni — Dečije selo', 'Kreiranje i praćenje sopstvenih zahteva — Dečije selo', 1, 11, '2026-08-18 16:11:28', '2026-08-18 16:40:54'),
(7, 'OFCDS', 'Koordinator službenog prostora i opreme — Dečije selo', 'Obrada zahteva za službeni prostor i opremu u prostoru — Dečije selo', 1, 21, '2026-08-18 16:11:28', '2026-08-18 16:11:28'),
(8, 'VHCDS', 'Koordinator službenih vozila — Dečije selo', 'Obrada zahteva za službena vozila — Dečije selo', 1, 31, '2026-08-18 16:11:28', '2026-08-18 16:11:28'),
(9, 'ICTDS', 'ICT podrška — Dečije selo', 'Obrada zahteva za ICT opremu — Dečije selo', 1, 41, '2026-08-18 16:11:28', '2026-08-18 16:11:28'),
(10, 'OTHDS', 'Koordinator za razvrstavanje zahteva — Dečije selo', 'Razvrstavanje zahteva iz kategorije Ostalo — Dečije selo', 1, 51, '2026-08-18 16:11:28', '2026-08-18 16:11:28'),
(11, 'WHF', 'Magacioner — Fondacija', 'Upravljanje opremom Fondacije', 1, 60, '2026-08-23 12:05:00', '2026-08-23 12:05:00'),
(12, 'WHDS', 'Magacioner — Dečije selo', 'Upravljanje opremom Dečijeg sela', 1, 61, '2026-08-23 12:05:00', '2026-08-23 12:05:00');

-- --------------------------------------------------------

--
-- Table structure for table `tickets`
--

CREATE TABLE `tickets` (
  `id` int(10) UNSIGNED NOT NULL,
  `ticket_no` varchar(40) NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `assigned_to` int(10) UNSIGNED DEFAULT NULL,
  `responsible_role_code` varchar(16) NOT NULL DEFAULT 'OTHF',
  `title` varchar(190) NOT NULL,
  `description` text NOT NULL,
  `category` varchar(120) NOT NULL DEFAULT 'General',
  `department_location` varchar(190) DEFAULT NULL,
  `issue_location` varchar(190) DEFAULT NULL,
  `asset_inventory_no` varchar(120) DEFAULT NULL,
  `priority` varchar(40) NOT NULL DEFAULT 'normal',
  `status` enum('open','in_progress','waiting','resolved','closed') NOT NULL DEFAULT 'open',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `closed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tickets`
--

INSERT INTO `tickets` (`id`, `ticket_no`, `user_id`, `assigned_to`, `responsible_role_code`, `title`, `description`, `category`, `department_location`, `issue_location`, `asset_inventory_no`, `priority`, `status`, `created_at`, `updated_at`, `closed_at`) VALUES
(9, 'SOS-20260710-16005', 3, 1, 'ICTF', 'ICT oprema — Moja kancelarija', 'Neisparavn je moj racunar, moli da ga popravite. FALA', 'ICT oprema', 'Centrala (Bulevar kralja Aleksandra 251)', 'Moja kancelarija', '3107FA17928', 'low', 'closed', '2026-07-10 17:11:27', '2026-07-12 10:31:05', '2026-07-12 10:31:05'),
(12, 'SOS-20260731-24487', 6, NULL, 'OFCF', 'Službeni prostor i oprema u prostoru — Suturen -magacinski prostor', 'Jutros je higijeničarka Emira Ramadani primetila curenje vode u magacinskom prostoru i to curenje se širi plafonom.  Na podu su kofe koje se brzo pune vodom i neophodna je HITNA reakcija jer se iznad magacinskog prostora nalaze razne instalacije', 'Službeni prostor i oprema u prostoru', 'Centrala (Bulevar kralja Aleksandra 251)', 'Suturen -magacinski prostor', NULL, 'urgent', 'in_progress', '2026-07-31 09:45:00', '2026-08-10 13:28:34', NULL),
(13, 'SOS-20260731-16458', 5, NULL, 'ICTF', 'ICT oprema — Kancelarija', 'Glavi dugme na misu, preskace, i ponekad ne raguje', 'ICT oprema', 'Centrala (Bulevar kralja Aleksandra 251)', 'Kancelarija', NULL, 'urgent', 'in_progress', '2026-07-31 12:19:11', '2026-07-31 12:21:11', NULL),
(14, 'SOS-20260731-37715', 1, 5, 'VHCF', 'Službena vozila — Fiat 500L', 'Na sluzbenom vozilu BG1433RB je ispustila guma. Potrebna mi je informacija sta da radim?', 'Službena vozila', 'Centrala (Bulevar kralja Aleksandra 251)', 'Fiat 500L', NULL, 'high', 'in_progress', '2026-07-31 12:24:36', '2026-07-31 12:30:25', NULL),
(15, 'SOS-20260810-12824', 6, NULL, 'ICTF', 'ICT oprema — Kraljevo', 'Kompjuter ne\'e sam da radi, tra\\i od mene da kucam [to se nismo dogovorili....blabla', 'ICT oprema', 'Centrala (Bulevar kralja Aleksandra 251)', 'Kraljevo', '5CG1354QRL', 'urgent', 'in_progress', '2026-08-10 13:27:22', '2026-08-10 13:30:00', NULL),
(16, 'SOS-20260810-26850', 8, NULL, 'OFCF', 'Službeni prostor i oprema u prostoru', 'Dimijev test', 'Službeni prostor i oprema u prostoru', 'Centrala (Bulevar kralja Aleksandra 251)', NULL, NULL, 'low', 'in_progress', '2026-08-10 13:55:48', '2026-08-10 14:00:12', NULL),
(17, 'SOS-20260810-15011', 9, NULL, 'ICTF', 'ICT oprema', 'Ne radi predmet', 'ICT oprema', 'Dečije selo Kraljevo (Prvomajska 46-A)', NULL, NULL, 'low', 'in_progress', '2026-08-10 13:56:03', '2026-08-10 14:05:02', NULL),
(18, 'SOS-20260810-13710', 8, NULL, 'ICTF', 'ICT oprema', 'Laptop je spor', 'ICT oprema', 'Centrala (Bulevar kralja Aleksandra 251)', NULL, '3178f17af', 'low', 'open', '2026-08-10 14:11:37', '2026-08-10 14:11:37', NULL),
(20, 'SOS-20260831-32520', 13, NULL, 'VHCF', 'Službena vozila', 'Test tiket', 'Službena vozila', 'Centrala (Bulevar kralja Aleksandra 251)', NULL, NULL, 'low', 'open', '2026-08-31 22:53:28', '2026-08-31 22:53:28', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `ticket_attachments`
--

CREATE TABLE `ticket_attachments` (
  `id` int(10) UNSIGNED NOT NULL,
  `ticket_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `is_internal` tinyint(1) NOT NULL DEFAULT 0,
  `original_name` varchar(255) NOT NULL,
  `stored_name` varchar(255) NOT NULL,
  `mime_type` varchar(120) NOT NULL,
  `file_size` bigint(20) UNSIGNED NOT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_attachments`
--

INSERT INTO `ticket_attachments` (`id`, `ticket_id`, `user_id`, `is_internal`, `original_name`, `stored_name`, `mime_type`, `file_size`, `created_at`) VALUES
(3, 9, 3, 0, 'racunarslika.jpg', 'ticket-9-7c9cf65a8b80d988c92438636dbda1e2.jpg', 'image/jpeg', 17234, '2026-07-10 17:11:27'),
(4, 9, 1, 0, '8a998d71880b349901880edd7306022d.pdf', 'ticket-9-95d56de9e294f2fd391e9e55a493a0b4.pdf', 'application/pdf', 554939, '2026-07-10 17:14:04');

-- --------------------------------------------------------

--
-- Table structure for table `ticket_categories`
--

CREATE TABLE `ticket_categories` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(120) NOT NULL,
  `ticket_code` char(1) NOT NULL DEFAULT '4',
  `responsible_role_code` varchar(16) NOT NULL DEFAULT 'OTHF',
  `sort_order` int(11) NOT NULL DEFAULT 100,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_categories`
--

INSERT INTO `ticket_categories` (`id`, `name`, `ticket_code`, `responsible_role_code`, `sort_order`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Službeni prostor i oprema u prostoru', '2', 'OFCF', 10, 1, '2026-07-10 11:01:05', '2026-07-17 09:51:20'),
(3, 'Službena vozila', '3', 'VHCF', 30, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(4, 'ICT oprema', '1', 'ICTF', 40, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(5, 'Ostalo', '4', 'OTHF', 50, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05');

-- --------------------------------------------------------

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

CREATE TABLE `ticket_comments` (
  `id` int(10) UNSIGNED NOT NULL,
  `ticket_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `comment` text NOT NULL,
  `is_internal` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `ticket_comments` (`id`, `ticket_id`, `user_id`, `comment`, `is_internal`, `created_at`) VALUES
(4, 9, 1, 'Vas racunar ne da nije isparavn nego je uzasan!', 0, '2026-07-10 17:14:04'),
(5, 9, 3, 'moj racunar a vas?', 0, '2026-07-10 17:15:09'),
(6, 9, 1, 'interni test', 1, '2026-07-10 17:15:43'),
(7, 9, 1, 'interni test2', 1, '2026-07-10 18:10:35'),
(8, 9, 3, 'problem sa racunarom i dalje postoji?', 0, '2026-07-12 10:18:23'),
(9, 9, 1, 'Zatvoricemo ovaj zahtev', 0, '2026-07-12 10:19:27'),
(10, 9, 3, 'I dalje imam isti problem?', 0, '2026-07-12 10:29:54'),
(11, 9, 1, 'Isti problem je resen.', 0, '2026-07-12 10:30:27'),
(13, 12, 6, 'Upravo je otpao deo plafona', 0, '2026-07-31 09:46:39'),
(14, 12, 7, 'Majstor pozvan', 0, '2026-07-31 11:41:55'),
(15, 13, 1, 'Predlazem da zamenimo mis.', 0, '2026-07-31 12:21:03'),
(16, 14, 5, 'Ako je samo ispustila, probaj da je napumpas (pumpa u gepeku), ako je pocepana zoves AMSS', 0, '2026-07-31 12:28:16'),
(17, 14, 1, 'Postupio sam po instrukciji. AMSS je rekao da ce uskoro doci.', 0, '2026-07-31 12:28:53'),
(18, 14, 5, 'test', 1, '2026-07-31 12:30:25'),
(19, 12, 6, 'Majstor još uvek nije došao', 0, '2026-08-03 10:45:16'),
(20, 12, 6, 'Upao mi je kom[ija sa sprata', 0, '2026-08-10 13:28:34'),
(21, 15, 1, 'Pokusajte da uradite restart racunara, ukoliko ne pomogne izacicemo na teren da pogledamo.', 0, '2026-08-10 13:30:00'),
(22, 17, 1, 'Predmet je popravljen', 0, '2026-08-10 13:58:50'),
(23, 16, 1, 'Viki test', 0, '2026-08-10 13:59:35'),
(24, 17, 1, 'test otvorio nabavku 2026-999', 1, '2026-08-10 14:05:02');

-- --------------------------------------------------------

--
-- Table structure for table `ticket_events`
--

CREATE TABLE `ticket_events` (
  `id` int(10) UNSIGNED NOT NULL,
  `ticket_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `event_type` varchar(60) NOT NULL,
  `old_value` varchar(255) DEFAULT NULL,
  `new_value` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_events`
--

INSERT INTO `ticket_events` (`id`, `ticket_id`, `user_id`, `event_type`, `old_value`, `new_value`, `created_at`) VALUES
(20, 9, 3, 'created', NULL, 'open', '2026-07-10 17:11:27'),
(21, 9, 1, 'status_changed', 'open', 'in_progress', '2026-07-10 17:13:11'),
(22, 9, 1, 'assigned_changed', '', '1', '2026-07-10 17:13:11'),
(23, 9, 1, 'comment', NULL, 'public', '2026-07-10 17:14:04'),
(24, 9, 1, 'attachment_added', NULL, '1', '2026-07-10 17:14:04'),
(25, 9, 3, 'comment', NULL, 'public', '2026-07-10 17:15:09'),
(26, 9, 1, 'comment', NULL, 'internal', '2026-07-10 17:15:43'),
(27, 9, 1, 'comment', NULL, 'internal', '2026-07-10 18:10:35'),
(28, 9, 3, 'comment', NULL, 'public', '2026-07-12 10:18:23'),
(29, 9, 1, 'comment', NULL, 'public', '2026-07-12 10:19:27'),
(30, 9, 1, 'status_changed', 'in_progress', 'waiting', '2026-07-12 10:19:57'),
(31, 9, 1, 'status_changed', 'waiting', 'resolved', '2026-07-12 10:20:08'),
(32, 9, 1, 'status_changed', 'resolved', 'closed', '2026-07-12 10:20:24'),
(33, 9, 1, 'status_changed', 'closed', 'resolved', '2026-07-12 10:21:24'),
(34, 9, 1, 'status_changed', 'resolved', 'closed', '2026-07-12 10:22:07'),
(35, 9, 3, 'comment', NULL, 'public', '2026-07-12 10:29:54'),
(36, 9, 3, 'status_changed', 'closed', 'open', '2026-07-12 10:29:54'),
(37, 9, 1, 'comment', NULL, 'public', '2026-07-12 10:30:27'),
(38, 9, 1, 'status_changed', 'open', 'in_progress', '2026-07-12 10:30:34'),
(39, 9, 1, 'status_changed', 'in_progress', 'closed', '2026-07-12 10:31:05'),
(54, 12, 6, 'created', NULL, 'open', '2026-07-31 09:45:00'),
(55, 12, 6, 'responsible_role_set', NULL, 'OFCF', '2026-07-31 09:45:00'),
(56, 12, 6, 'comment', NULL, 'public', '2026-07-31 09:46:39'),
(57, 12, 7, 'comment', NULL, 'public', '2026-07-31 11:41:55'),
(58, 12, 7, 'status_changed', 'open', 'in_progress', '2026-07-31 11:42:09'),
(59, 13, 5, 'created', NULL, 'open', '2026-07-31 12:19:11'),
(60, 13, 5, 'responsible_role_set', NULL, 'ICTF', '2026-07-31 12:19:11'),
(61, 13, 5, 'participant_added', NULL, 'Maja Pantic', '2026-07-31 12:19:11'),
(62, 13, 5, 'participant_added', NULL, 'Vesna Lekic', '2026-07-31 12:19:11'),
(63, 13, 1, 'comment', NULL, 'public', '2026-07-31 12:21:03'),
(64, 13, 1, 'status_changed', 'open', 'in_progress', '2026-07-31 12:21:11'),
(65, 14, 1, 'created', NULL, 'open', '2026-07-31 12:24:36'),
(66, 14, 1, 'responsible_role_set', NULL, 'VHCF', '2026-07-31 12:24:36'),
(67, 14, 1, 'participant_added', NULL, 'Vesna Lekic', '2026-07-31 12:24:36'),
(68, 14, 5, 'status_changed', 'open', 'in_progress', '2026-07-31 12:26:58'),
(69, 14, 5, 'priority_changed', 'urgent', 'high', '2026-07-31 12:26:58'),
(70, 14, 5, 'assigned_changed', '', '5', '2026-07-31 12:26:58'),
(71, 14, 5, 'comment', NULL, 'public', '2026-07-31 12:28:16'),
(72, 14, 1, 'comment', NULL, 'public', '2026-07-31 12:28:53'),
(73, 14, 5, 'comment', NULL, 'internal', '2026-07-31 12:30:25'),
(74, 12, 6, 'comment', NULL, 'public', '2026-08-03 10:45:16'),
(75, 15, 6, 'created', NULL, 'open', '2026-08-10 13:27:22'),
(76, 15, 6, 'responsible_role_set', NULL, 'ICTF', '2026-08-10 13:27:22'),
(77, 12, 6, 'comment', NULL, 'public', '2026-08-10 13:28:34'),
(78, 15, 1, 'status_changed', 'open', 'in_progress', '2026-08-10 13:29:57'),
(79, 15, 1, 'comment', NULL, 'public', '2026-08-10 13:30:00'),
(80, 16, 8, 'created', NULL, 'open', '2026-08-10 13:55:48'),
(81, 16, 8, 'responsible_role_set', NULL, 'OFCF', '2026-08-10 13:55:48'),
(82, 17, 9, 'created', NULL, 'open', '2026-08-10 13:56:03'),
(83, 17, 9, 'responsible_role_set', NULL, 'ICTF', '2026-08-10 13:56:03'),
(84, 16, 8, 'participant_added', NULL, 'Kristina Nedeljkovic', '2026-08-10 13:56:23'),
(85, 17, 9, 'participant_added', NULL, 'Tamara Premovic', '2026-08-10 13:57:14'),
(86, 17, 1, 'comment', NULL, 'public', '2026-08-10 13:58:50'),
(87, 16, 1, 'comment', NULL, 'public', '2026-08-10 13:59:35'),
(88, 16, 1, 'status_changed', 'open', 'in_progress', '2026-08-10 14:00:12'),
(89, 17, 1, 'status_changed', 'open', 'in_progress', '2026-08-10 14:00:17'),
(90, 17, 1, 'comment', NULL, 'internal', '2026-08-10 14:05:02'),
(91, 18, 8, 'created', NULL, 'open', '2026-08-10 14:11:37'),
(92, 18, 8, 'responsible_role_set', NULL, 'ICTF', '2026-08-10 14:11:37'),
(127, 20, 13, 'created', NULL, 'open', '2026-08-31 22:53:28'),
(128, 20, 13, 'responsible_role_set', NULL, 'VHCF', '2026-08-31 22:53:28');

-- --------------------------------------------------------

--
-- Table structure for table `ticket_locations`
--

CREATE TABLE `ticket_locations` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(190) NOT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 100,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_locations`
--

INSERT INTO `ticket_locations` (`id`, `name`, `sort_order`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Centrala (Bulevar kralja Aleksandra 251)', 10, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(2, 'Odeljenje za prikupljanje sredstava (Jove Ilića 104)', 20, 1, '2026-07-10 11:01:05', '2026-07-10 17:02:09'),
(3, 'PJP Zemun (Prvomajska 118)', 30, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(4, 'PJP Obrenovac (Kneza Mihaila 5/5)', 40, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(5, 'PJP Niš (Svetozara Markovića 1/2)', 50, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(6, 'PJP Gadžin Han (Vuka Karadžića 1)', 60, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(7, 'Dečije selo Kraljevo (Prvomajska 46-A)', 70, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(8, 'PJP Kraljevo (Prvomajska 46-A)', 80, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(9, 'PJP Čačak (Lomina 53)', 90, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(10, 'PJP Vrnjačka Banja (Trstenička BB)', 100, 1, '2026-07-10 11:01:05', '2026-07-17 10:06:22'),
(11, 'PJP Raška (Ibarska 4)', 110, 1, '2026-07-10 11:01:05', '2026-08-29 08:53:43'),
(12, 'PJP Trstenik (Obrena Ljutića 13)', 120, 1, '2026-07-10 11:01:05', '2026-07-17 10:06:29');

-- --------------------------------------------------------

--
-- Table structure for table `ticket_participants`
--

CREATE TABLE `ticket_participants` (
  `ticket_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `added_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_participants`
--

INSERT INTO `ticket_participants` (`ticket_id`, `user_id`, `added_by`, `created_at`) VALUES
(13, 6, 5, '2026-07-31 12:19:11'),
(13, 7, 5, '2026-07-31 12:19:11'),
(14, 6, 1, '2026-07-31 12:24:36'),
(16, 9, 8, '2026-08-10 13:56:23'),
(17, 8, 9, '2026-08-10 13:57:14');

-- --------------------------------------------------------

--
-- Table structure for table `ticket_priorities`
--

CREATE TABLE `ticket_priorities` (
  `id` int(10) UNSIGNED NOT NULL,
  `priority_key` varchar(40) NOT NULL,
  `name` varchar(120) NOT NULL,
  `description` varchar(190) DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 100,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ticket_priorities`
--

INSERT INTO `ticket_priorities` (`id`, `priority_key`, `name`, `description`, `sort_order`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'low', 'Nizak', 'rešava se u roku od 15 radnih dana', 10, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(2, 'normal', 'Srednji', 'rešava se u roku od 10 radnih dana', 20, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(3, 'high', 'Visok', 'rešava se u roku od 5 radnih dana', 30, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05'),
(4, 'urgent', 'Hitno', 'odmah po hitnom postupku', 40, 1, '2026-07-10 11:01:05', '2026-07-10 11:01:05');

-- --------------------------------------------------------

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

CREATE TABLE `users` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(120) NOT NULL,
  `email` varchar(190) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `is_system_admin` tinyint(1) NOT NULL DEFAULT 0,
  `job_title` varchar(120) DEFAULT NULL,
  `phone` varchar(60) DEFAULT NULL,
  `location` varchar(120) DEFAULT NULL,
  `manager_name` varchar(120) DEFAULT NULL,
  `department` varchar(120) DEFAULT NULL,
  `employee_code` varchar(80) DEFAULT NULL,
  `profile_photo` varchar(255) DEFAULT NULL,
  `last_login_at` datetime DEFAULT NULL,
  `entra_object_id` char(36) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
  `entra_tenant_id` char(36) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `must_change_password` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users` (`id`, `name`, `email`, `password_hash`, `is_system_admin`, `job_title`, `phone`, `location`, `manager_name`, `department`, `employee_code`, `profile_photo`, `last_login_at`, `entra_object_id`, `entra_tenant_id`, `is_active`, `must_change_password`, `created_at`, `updated_at`) VALUES
(1, 'dima', 'dima@sos-decijasela.rs', '$2y$12$XYlJNEfkF/am2/nzqlDCS.7YFjriclJ6Cl64aAdGO8S.EuSS2GCK2', 1, 'IT', '+38161289330', 'Beograd', 'Vesna', 'Aj ti Dimo', NULL, 'uploads/avatars/user-1-20260512195905-8ffc5c65.jpg', '2026-09-03 20:41:45', NULL, NULL, 1, 0, '2026-05-12 11:59:37', '2026-07-09 11:31:00'),
(2, 'Ana', 'ana@sos-decijasela.rs', '$2y$12$bzAuuNpF4ijGmtdphwVzreFGjYuXsUYKPHe87S8qIg1t/67ZW79yW', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, '2026-05-12 12:01:00', '2026-05-12 21:05:35'),
(3, 'Test Testic', 'test@sos-decijasela.rs', '$2y$12$6g30WyRHhni9aosIiI0n4OMZXySCzxd/hJl0qj0/8gHr0kS2OyAvq', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-08-26 20:17:01', NULL, NULL, 1, 0, '2026-07-10 17:07:07', '2026-08-23 18:09:21'),
(5, 'Boris Djordjevic', 'boris.djordjevic@sos-decijasela.rs', '$2y$12$gqJdf.w4m9lQ8RLNlGlHFu8Seobfx0FrlIgRdPVdsPYMrq0n9J9Ru', 0, 'Vozač - logističar', '+381646495636', 'Bulevar kralja Aleksandra 251, Beograd', 'Vesna Lekić', 'Odeljenje finansija', NULL, NULL, '2026-08-17 13:17:38', NULL, NULL, 1, 0, '2026-07-26 16:33:41', '2026-07-31 12:12:04'),
(6, 'Vesna Lekic', 'vesna.lekic@sos-decijasela.rs', '$2y$12$S0tyDL71Ep5C3lluttxHyuk4FzjwZT53Rf.78idGyf64AlRvBTuzy', 0, 'Direktorka finansija', '+381652252541', 'Bulevar kralja Aleksandra 251', 'Vesna Mrakovic', 'Odeljenje finansija i administracije', NULL, NULL, '2026-09-07 16:12:24', '9b5bf42c-32a3-41a5-880d-6f01e1abcb30', '25813e1e-a1f8-4bcf-8412-54ae47072665', 1, 0, '2026-07-30 21:18:21', '2026-09-07 16:12:24'),
(7, 'Maja Pantic', 'maja.pantic@sos-decijasela.rs', '$2y$12$3iW0P2Lfi0OUGamSfgQXMOsklzYtWY5IqTL0w/MmeaK2zPQ1wODze', 0, 'Glavni racunovodja', '+381646495431', 'Bulevar kralja Aleksandra 251', 'Vesna Lekic', 'Odeljenje finansija i administracije', NULL, NULL, '2026-07-31 11:37:45', NULL, NULL, 1, 0, '2026-07-31 11:28:28', '2026-07-31 11:38:11'),
(8, 'Tamara Premovic', 'tamara.premovic@sos-decijasela.rs', '$2y$12$H4LwbL40W8jzVatzr8vyuexBR9xmfRUusJo5ZPsRyMYJKci7LfLf2', 0, 'Kordinatorka finansijsko administartivnog tima', '+381648268980', 'Prvomajska 46A', 'Biljana Zoric Dimic', 'Odeljenje finansija i administracije', NULL, NULL, '2026-08-13 14:21:01', NULL, NULL, 1, 0, '2026-08-10 13:32:00', '2026-08-10 14:08:10'),
(9, 'Kristina Nedeljkovic', 'kristina.nedeljkovic@sos-decijasela.rs', '$2y$12$sWFPg/7MjSxw5bq69Zqi5uMkUtIqIRcj/.4NCW9fVmOZGZqFg5fSi', 0, 'Saradnica za finansijsko administrativne poslove', '+381652106430', 'Prvomajska 46A', 'Tamara Premovic', 'Odeljenje finansija i administracije', NULL, NULL, '2026-08-10 13:52:33', NULL, NULL, 1, 0, '2026-08-10 13:35:49', '2026-08-10 14:08:14'),
(11, 'Eksterna Podrska', 'eksterna.ictpodrska@sos-decijasela.rs', '$2y$12$2X6jzaq2da/A4GqAAlZQXu5K2r5KmSw9/8gq1yZkRRJVlYnM.tEj.', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-09-07 15:21:51', NULL, NULL, 1, 0, '2026-08-28 19:30:40', '2026-08-29 01:18:57'),
(13, 'TestZaposleni', 'danilo.lekic94@gmail.com', '$2y$12$XGNiDU2KB/cXwliCloMpj.ucakajsppILy2DXEMV8Yb.VcRSHQ4Qq', 0, 'ICT Coordinator', '+38112345', 'Centrala, Beograd', 'Pera Peric', 'ICT', NULL, NULL, '2026-08-31 22:44:35', NULL, NULL, 1, 0, '2026-08-31 22:44:07', '2026-08-31 22:46:57'),
(14, 'TestZaposleni2', 'danilo.lekic94+test2@gmail.com', '$2y$12$3B6CpGHxO.s1fxgsiXPKFeRRCx8tMGJ84s9EQ73rew5DfuJUAuxea', 0, 'ICT', '+38112345', 'Centrala, Beograd', 'Pera Peric', 'ICT', NULL, NULL, '2026-08-31 23:15:43', NULL, NULL, 1, 0, '2026-08-31 23:07:29', '2026-08-31 23:20:52'),
(15, 'Dimitrije Tripkovic', 'dimitrije.tripkovic@sos-decijasela.rs', '$2y$12$dV2xaemY9h1mlSoohibx8umqPIPLyjcfccAdeZsfqRU.aqSw4zAI.', 1, 'ICT Koordinator', '+381668029360', 'Bulevar kralja Aleksandra 251, Beograd', 'Vesna Lekic', 'ICT', NULL, NULL, '2026-09-07 16:12:36', '1237f4f7-d6ca-4b9b-9d16-dcd7d7a5455a', '25813e1e-a1f8-4bcf-8412-54ae47072665', 1, 0, '2026-09-03 20:42:45', '2026-09-03 22:19:25');

-- --------------------------------------------------------

--
-- Table structure for table `user_roles`
--

CREATE TABLE `user_roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_roles`
--

INSERT INTO `user_roles` (`id`, `user_id`, `role_id`, `created_at`, `created_by`) VALUES
(1, 1, 1, '2026-07-26 14:23:23', NULL),
(2, 2, 1, '2026-07-26 14:23:23', NULL),
(3, 3, 1, '2026-07-26 14:23:23', NULL),
(8, 1, 4, '2026-07-26 14:23:23', NULL),
(9, 5, 1, '2026-07-26 16:33:41', 1),
(10, 5, 3, '2026-07-26 16:33:41', 1),
(11, 6, 1, '2026-07-30 21:18:21', 1),
(12, 7, 1, '2026-07-31 11:28:28', 1),
(13, 7, 2, '2026-07-31 11:28:28', 1),
(15, 8, 1, '2026-08-10 13:32:00', 1),
(16, 9, 1, '2026-08-10 13:35:49', 1),
(22, 3, 11, '2026-08-23 18:09:21', 1),
(23, 13, 1, '2026-08-31 22:44:07', 11),
(25, 14, 4, '2026-08-31 23:20:52', 11),
(26, 15, 1, '2026-09-03 20:42:45', 1);

-- --------------------------------------------------------

--
-- Table structure for table `user_role_events`
--

CREATE TABLE `user_role_events` (
  `id` int(10) UNSIGNED NOT NULL,
  `target_user_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL,
  `changed_by` int(10) UNSIGNED DEFAULT NULL,
  `action` enum('added','removed') NOT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_role_events`
--

INSERT INTO `user_role_events` (`id`, `target_user_id`, `role_id`, `changed_by`, `action`, `created_at`) VALUES
(1, 1, 1, NULL, 'added', '2026-07-26 14:23:23'),
(2, 2, 1, NULL, 'added', '2026-07-26 14:23:23'),
(3, 3, 1, NULL, 'added', '2026-07-26 14:23:23'),
(5, 1, 4, NULL, 'added', '2026-07-26 14:23:23'),
(8, 5, 1, 1, 'added', '2026-07-26 16:33:41'),
(9, 5, 3, 1, 'added', '2026-07-26 16:33:41'),
(10, 6, 1, 1, 'added', '2026-07-30 21:18:21'),
(11, 7, 1, 1, 'added', '2026-07-31 11:28:28'),
(12, 7, 2, 1, 'added', '2026-07-31 11:28:28'),
(13, 3, 3, 1, 'added', '2026-08-01 17:49:19'),
(14, 3, 3, 1, 'removed', '2026-08-01 17:52:55'),
(15, 8, 1, 1, 'added', '2026-08-10 13:32:00'),
(16, 9, 1, 1, 'added', '2026-08-10 13:35:49'),
(17, 8, 4, 1, 'added', '2026-08-10 14:06:11'),
(18, 9, 4, 1, 'added', '2026-08-10 14:06:17'),
(19, 8, 4, 1, 'removed', '2026-08-10 14:08:10'),
(20, 9, 4, 1, 'removed', '2026-08-10 14:08:14'),
(21, 3, 9, 1, 'added', '2026-08-18 23:28:52'),
(22, 3, 9, 1, 'removed', '2026-08-18 23:30:15'),
(23, 3, 4, 1, 'added', '2026-08-18 23:31:57'),
(24, 3, 4, 1, 'removed', '2026-08-18 23:35:05'),
(26, 3, 11, 1, 'added', '2026-08-23 18:09:21'),
(27, 13, 1, 11, 'added', '2026-08-31 22:44:07'),
(28, 14, 3, 11, 'added', '2026-08-31 23:07:29'),
(29, 14, 4, 11, 'added', '2026-08-31 23:20:52'),
(30, 14, 3, 11, 'removed', '2026-08-31 23:20:52'),
(31, 15, 1, 1, 'added', '2026-09-03 20:42:45');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `equipment`
--
ALTER TABLE `equipment`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_equipment_org_inventory` (`organization_unit`,`inventory_no`),
  ADD KEY `idx_equipment_user_status` (`user_id`,`status`),
  ADD KEY `idx_equipment_serial` (`serial_no`),
  ADD KEY `idx_equipment_inventory` (`inventory_no`),
  ADD KEY `idx_equipment_warehouse` (`is_in_warehouse`),
  ADD KEY `idx_equipment_organization_unit` (`organization_unit`),
  ADD KEY `idx_equipment_org_status` (`organization_unit`,`status`);

--
-- Indexes for table `equipment_assignment_events`
--
ALTER TABLE `equipment_assignment_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_equipment_assignment_events_equipment_created` (`equipment_id`,`created_at`),
  ADD KEY `idx_equipment_assignment_events_changed_by` (`changed_by`);

--
-- Indexes for table `equipment_audit_events`
--
ALTER TABLE `equipment_audit_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_equipment_audit_equipment_created` (`equipment_id`,`created_at`),
  ADD KEY `idx_equipment_audit_actor_created` (`actor_user_id`,`created_at`);

--
-- Indexes for table `login_attempts`
--
ALTER TABLE `login_attempts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_login_email_success_time` (`email_hash`,`success`,`attempted_at`,`id`),
  ADD KEY `idx_login_ip_success_time` (`ip_hash`,`success`,`attempted_at`),
  ADD KEY `idx_login_attempted_at` (`attempted_at`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_notifications_user_read_created` (`user_id`,`is_read`,`created_at`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_roles_code` (`role_code`),
  ADD UNIQUE KEY `uq_roles_name` (`name`),
  ADD KEY `idx_roles_active_sort` (`is_active`,`sort_order`);

--
-- Indexes for table `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_tickets_ticket_no` (`ticket_no`),
  ADD KEY `idx_tickets_user_id` (`user_id`),
  ADD KEY `idx_tickets_assigned_to` (`assigned_to`),
  ADD KEY `idx_tickets_status_priority` (`status`,`priority`),
  ADD KEY `idx_tickets_updated_at` (`updated_at`),
  ADD KEY `idx_tickets_department_location` (`department_location`),
  ADD KEY `idx_tickets_asset_inventory_no` (`asset_inventory_no`),
  ADD KEY `idx_tickets_responsible_role_status` (`responsible_role_code`,`status`,`updated_at`);

--
-- Indexes for table `ticket_attachments`
--
ALTER TABLE `ticket_attachments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_ticket_attachments_stored_name` (`stored_name`),
  ADD KEY `idx_attachments_ticket_created` (`ticket_id`,`created_at`),
  ADD KEY `idx_attachments_user_id` (`user_id`),
  ADD KEY `idx_attachments_internal` (`is_internal`);

--
-- Indexes for table `ticket_categories`
--
ALTER TABLE `ticket_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_ticket_categories_name` (`name`),
  ADD KEY `idx_ticket_categories_active_sort` (`is_active`,`sort_order`),
  ADD KEY `idx_ticket_categories_responsible_role` (`responsible_role_code`);

--
-- Indexes for table `ticket_comments`
--
ALTER TABLE `ticket_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_comments_ticket_id` (`ticket_id`),
  ADD KEY `idx_comments_user_id` (`user_id`),
  ADD KEY `idx_comments_internal` (`is_internal`),
  ADD KEY `idx_comments_ticket_created_id` (`ticket_id`,`created_at`,`id`);

--
-- Indexes for table `ticket_events`
--
ALTER TABLE `ticket_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_events_ticket_id` (`ticket_id`),
  ADD KEY `idx_events_user_id` (`user_id`),
  ADD KEY `idx_events_created_at` (`created_at`),
  ADD KEY `idx_events_ticket_created_id` (`ticket_id`,`created_at`,`id`);

--
-- Indexes for table `ticket_locations`
--
ALTER TABLE `ticket_locations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_ticket_locations_name` (`name`),
  ADD KEY `idx_ticket_locations_active_sort` (`is_active`,`sort_order`);

--
-- Indexes for table `ticket_participants`
--
ALTER TABLE `ticket_participants`
  ADD PRIMARY KEY (`ticket_id`,`user_id`),
  ADD KEY `idx_ticket_participants_user_ticket` (`user_id`,`ticket_id`),
  ADD KEY `idx_ticket_participants_added_by` (`added_by`);

--
-- Indexes for table `ticket_priorities`
--
ALTER TABLE `ticket_priorities`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_ticket_priorities_key` (`priority_key`),
  ADD UNIQUE KEY `uq_ticket_priorities_name` (`name`),
  ADD KEY `idx_ticket_priorities_active_sort` (`is_active`,`sort_order`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_users_email` (`email`),
  ADD UNIQUE KEY `uq_users_entra_object_id` (`entra_object_id`),
  ADD KEY `idx_users_must_change_password` (`must_change_password`),
  ADD KEY `idx_users_system_admin_active` (`is_system_admin`,`is_active`),
  ADD KEY `idx_users_entra_tenant_object` (`entra_tenant_id`,`entra_object_id`);

--
-- Indexes for table `user_roles`
--
ALTER TABLE `user_roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_user_roles_user_role` (`user_id`,`role_id`),
  ADD KEY `idx_user_roles_role_user` (`role_id`,`user_id`),
  ADD KEY `idx_user_roles_created_by` (`created_by`);

--
-- Indexes for table `user_role_events`
--
ALTER TABLE `user_role_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_role_events_target_created` (`target_user_id`,`created_at`),
  ADD KEY `idx_user_role_events_role` (`role_id`),
  ADD KEY `idx_user_role_events_changed_by` (`changed_by`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `equipment`
--
ALTER TABLE `equipment`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `equipment_assignment_events`
--
ALTER TABLE `equipment_assignment_events`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `equipment_audit_events`
--
ALTER TABLE `equipment_audit_events`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `login_attempts`
--
ALTER TABLE `login_attempts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=76;

--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=128;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `tickets`
--
ALTER TABLE `tickets`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `ticket_attachments`
--
ALTER TABLE `ticket_attachments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `ticket_categories`
--
ALTER TABLE `ticket_categories`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `ticket_comments`
--
ALTER TABLE `ticket_comments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=49;

--
-- AUTO_INCREMENT for table `ticket_events`
--
ALTER TABLE `ticket_events`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=129;

--
-- AUTO_INCREMENT for table `ticket_locations`
--
ALTER TABLE `ticket_locations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `ticket_priorities`
--
ALTER TABLE `ticket_priorities`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `user_roles`
--
ALTER TABLE `user_roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT for table `user_role_events`
--
ALTER TABLE `user_role_events`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `equipment`
--
ALTER TABLE `equipment`
  ADD CONSTRAINT `fk_equipment_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `equipment_assignment_events`
--
ALTER TABLE `equipment_assignment_events`
  ADD CONSTRAINT `fk_equipment_assignment_events_changed_by` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_equipment_assignment_events_equipment` FOREIGN KEY (`equipment_id`) REFERENCES `equipment` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `equipment_audit_events`
--
ALTER TABLE `equipment_audit_events`
  ADD CONSTRAINT `fk_equipment_audit_actor` FOREIGN KEY (`actor_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `fk_notifications_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tickets`
--
ALTER TABLE `tickets`
  ADD CONSTRAINT `fk_tickets_assigned` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_tickets_responsible_role` FOREIGN KEY (`responsible_role_code`) REFERENCES `roles` (`role_code`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_tickets_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `ticket_attachments`
--
ALTER TABLE `ticket_attachments`
  ADD CONSTRAINT `fk_attachments_ticket` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_attachments_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `ticket_categories`
--
ALTER TABLE `ticket_categories`
  ADD CONSTRAINT `fk_ticket_categories_responsible_role` FOREIGN KEY (`responsible_role_code`) REFERENCES `roles` (`role_code`) ON UPDATE CASCADE;

--
-- Constraints for table `ticket_comments`
--
ALTER TABLE `ticket_comments`
  ADD CONSTRAINT `fk_comments_ticket` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_comments_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `ticket_events`
--
ALTER TABLE `ticket_events`
  ADD CONSTRAINT `fk_events_ticket` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_events_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `ticket_participants`
--
ALTER TABLE `ticket_participants`
  ADD CONSTRAINT `fk_ticket_participants_added_by` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_ticket_participants_ticket` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_ticket_participants_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_roles`
--
ALTER TABLE `user_roles`
  ADD CONSTRAINT `fk_user_roles_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_user_roles_role` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  ADD CONSTRAINT `fk_user_roles_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_role_events`
--
ALTER TABLE `user_role_events`
  ADD CONSTRAINT `fk_user_role_events_changed_by` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_user_role_events_role` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  ADD CONSTRAINT `fk_user_role_events_target` FOREIGN KEY (`target_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
