-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 01, 2026 at 07:22 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: `bci_incident_reports`
--

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

--
-- Table structure for table `incident_activity_log`
--

CREATE TABLE `incident_activity_log` (
  `id` int(11) NOT NULL,
  `incident_id` int(11) NOT NULL,
  `activity_type` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `performed_by` varchar(255) DEFAULT NULL,
  `activity_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `incident_activity_log`
--

INSERT INTO `incident_activity_log` (`id`, `incident_id`, `activity_type`, `description`, `performed_by`, `activity_date`) VALUES
(1, 1, 'report_submitted', 'Initial incident report submitted', NULL, '2026-02-01 06:12:13');

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

--
-- Table structure for table `incident_files`
--

CREATE TABLE `incident_files` (
  `id` int(11) NOT NULL,
  `incident_id` int(11) NOT NULL,
  `original_filename` varchar(255) NOT NULL,
  `stored_filename` varchar(255) NOT NULL,
  `file_size` int(11) NOT NULL,
  `file_type` varchar(100) NOT NULL,
  `upload_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `incident_reports`
--

CREATE TABLE `incident_reports` (
  `id` int(11) NOT NULL,
  `reference_id` varchar(50) NOT NULL,
  `submission_date` datetime NOT NULL DEFAULT current_timestamp(),
  `reporter_full_name` varchar(255) NOT NULL,
  `reporter_organization` varchar(255) NOT NULL,
  `reporter_email` varchar(255) NOT NULL,
  `reporter_phone` varchar(50) NOT NULL,
  `reporter_position` varchar(255) DEFAULT NULL,
  `reporter_contact_method` enum('Email','Phone','Both') DEFAULT 'Email',
  `incident_type` varchar(100) NOT NULL,
  `incident_date` date NOT NULL,
  `incident_status` enum('Ongoing','Resolved','Under Investigation','Unknown') DEFAULT 'Ongoing',
  `affected_systems` int(11) DEFAULT 0,
  `incident_description` text NOT NULL,
  `priority` enum('critical','high','standard') NOT NULL,
  `data_compromised` enum('Yes','No','Unknown') DEFAULT 'Unknown',
  `financial_impact` varchar(50) DEFAULT NULL,
  `business_impact` text DEFAULT NULL,
  `law_enforcement_reported` enum('Yes','No','Not Yet','Pending') DEFAULT 'Not Yet',
  `law_enforcement_consent` tinyint(1) DEFAULT 0,
  `status` enum('new','in_progress','resolved','closed') DEFAULT 'new',
  `assigned_to` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `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 `incident_reports`
--

INSERT INTO `incident_reports` (`id`, `reference_id`, `submission_date`, `reporter_full_name`, `reporter_organization`, `reporter_email`, `reporter_phone`, `reporter_position`, `reporter_contact_method`, `incident_type`, `incident_date`, `incident_status`, `affected_systems`, `incident_description`, `priority`, `data_compromised`, `financial_impact`, `business_impact`, `law_enforcement_reported`, `law_enforcement_consent`, `status`, `assigned_to`, `notes`, `created_at`, `updated_at`) VALUES
(1, 'BCI-20260201071212-879C64', '2026-02-01 06:12:12', 'Franklin', 'Dawen Nelimor', 'f.nelimor@gmail.com', '0556711986', '', '', 'Ransomware Attack', '2026-02-01', '', 0, 'The Phone all of a sudden started misbehaving like ...', 'high', 'Unknown', 'Unknown', '', 'Not Yet', 1, 'new', NULL, NULL, '2026-02-01 06:12:12', '2026-02-01 06:12:12');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `incident_activity_log`
--
ALTER TABLE `incident_activity_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_incident_id` (`incident_id`),
  ADD KEY `idx_activity_date` (`activity_date`);

--
-- Indexes for table `incident_files`
--
ALTER TABLE `incident_files`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_incident_id` (`incident_id`);

--
-- Indexes for table `incident_reports`
--
ALTER TABLE `incident_reports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `reference_id` (`reference_id`),
  ADD KEY `idx_reference_id` (`reference_id`),
  ADD KEY `idx_submission_date` (`submission_date`),
  ADD KEY `idx_priority` (`priority`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_reporter_email` (`reporter_email`),
  ADD KEY `idx_incident_type` (`incident_type`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `incident_activity_log`
--
ALTER TABLE `incident_activity_log`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `incident_files`
--
ALTER TABLE `incident_files`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `incident_reports`
--
ALTER TABLE `incident_reports`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `incident_activity_log`
--
ALTER TABLE `incident_activity_log`
  ADD CONSTRAINT `incident_activity_log_ibfk_1` FOREIGN KEY (`incident_id`) REFERENCES `incident_reports` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `incident_files`
--
ALTER TABLE `incident_files`
  ADD CONSTRAINT `incident_files_ibfk_1` FOREIGN KEY (`incident_id`) REFERENCES `incident_reports` (`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 */;
