CREATE DATABASE IF NOT EXISTS `turnitin_db` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE `turnitin_db`;

CREATE TABLE requests (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT NOT NULL,
  title VARCHAR(255) NOT NULL,
  course VARCHAR(150) DEFAULT NULL,
  supervisor VARCHAR(150) DEFAULT NULL,
  description TEXT,
  file_path VARCHAR(255) NOT NULL,
  submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  status ENUM('Pending','In Progress','Completed','Rejected') DEFAULT 'Pending',
  similarity_score VARCHAR(50) DEFAULT NULL,
  report_path VARCHAR(255) DEFAULT NULL,
  admin_notes TEXT DEFAULT NULL,
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB;
