-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 06, 2026 at 10:04 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

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: `iot`
--

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

--
-- Table structure for table `drawing_points`
--

CREATE TABLE `drawing_points` (
  `id` int(10) UNSIGNED NOT NULL,
  `building_id` int(11) NOT NULL,
  `floor_id` int(11) NOT NULL,
  `point_name` varchar(150) NOT NULL,
  `point_type` enum('trigger','exit','assembly_point','extinguisher','first_aid') NOT NULL DEFAULT 'trigger',
  `pos_x` decimal(5,2) NOT NULL COMMENT 'Relative X coordinate in percentage (0.00 to 100.00)',
  `pos_y` decimal(5,2) NOT NULL COMMENT 'Relative Y coordinate in percentage (0.00 to 100.00)',
  `status` enum('active','inactive','maintenance') NOT NULL DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `drawing_points`
--

INSERT INTO `drawing_points` (`id`, `building_id`, `floor_id`, `point_name`, `point_type`, `pos_x`, `pos_y`, `status`, `created_at`, `updated_at`) VALUES
(1, 6, 2, 'Smoke Detector', 'trigger', 74.11, 47.45, 'active', '2026-08-06 01:59:35', '2026-08-06 01:59:35'),
(2, 6, 2, 'Smoke Detector', 'trigger', 32.87, 63.38, 'active', '2026-08-06 01:59:43', '2026-08-06 01:59:43'),
(3, 6, 2, 'Smoke Detector', 'trigger', 44.59, 63.03, 'active', '2026-08-06 01:59:56', '2026-08-06 01:59:56'),
(4, 6, 2, 'Smoke Detector', 'trigger', 52.75, 52.53, 'active', '2026-08-06 02:00:00', '2026-08-06 02:00:00'),
(5, 6, 2, 'Smoke Detector', 'trigger', 17.12, 64.79, 'active', '2026-08-06 02:00:04', '2026-08-06 02:00:04'),
(6, 6, 2, 'Exit A', 'exit', 56.69, 37.29, 'active', '2026-08-06 02:01:42', '2026-08-06 02:01:42'),
(7, 6, 2, 'Exit B', 'exit', 77.95, 39.04, 'active', '2026-08-06 02:02:04', '2026-08-06 02:02:04');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `drawing_points`
--
ALTER TABLE `drawing_points`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_building_id` (`building_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `drawing_points`
--
ALTER TABLE `drawing_points`
  ADD CONSTRAINT `fk_drawing_points_building` FOREIGN KEY (`building_id`) REFERENCES `building_details` (`id`) ON DELETE CASCADE ON UPDATE 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 */;
