```sql -- lost_and_found_schema.sql CREATE DATABASE IF NOT EXISTS lost_and_found; USE lost_and_found; -- Users table (Finder and Owner) CREATE TABLE users ( userId INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, email VARCHAR(150) NOT NULL UNIQUE, passwordHash VARCHAR(255) NOT NULL, role ENUM('finder','owner') NOT NULL, createdAt DATETIME DEFAULT CURRENT_TIMESTAMP ); -- Admins (separate table per ERD) CREATE TABLE admins ( adminId INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(100) NOT NULL UNIQUE, passwordHash VARCHAR(255) NOT NULL, name VARCHAR(100), createdAt DATETIME DEFAULT CURRENT_TIMESTAMP ); -- Storage locations CREATE TABLE storage_locations ( locationID INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(150), address TEXT, contactInfo VARCHAR(255) ); -- Reports (submitted by Finder) CREATE TABLE reports ( reportID INT AUTO_INCREMENT PRIMARY KEY, userId INT NOT NULL, -- finder who submitted the report timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, status ENUM('open','under_review','verified','rejected','closed') DEFAULT 'open', locationFound VARCHAR(255), notes TEXT, FOREIGN KEY (userId) REFERENCES users(userId) ON DELETE CASCADE ); -- Items (concerned in reports; 0..* per report) CREATE TABLE items ( itemID INT AUTO_INCREMENT PRIMARY KEY, reportID INT, description TEXT, category VARCHAR(100), status ENUM('stored','available','claimed','returned','lost') DEFAULT 'stored', storageLocationID INT, imagePath VARCHAR(255), createdAt DATETIME DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (reportID) REFERENCES reports(reportID) ON DELETE SET NULL, FOREIGN KEY (storageLocationID) REFERENCES storage_locations(locationID) ON DELETE SET NULL ); -- Verifications (performed by admins) CREATE TABLE verifications ( verificationID INT AUTO_INCREMENT PRIMARY KEY, reportID INT, itemID INT, adminId INT, vDate DATETIME DEFAULT CURRENT_TIMESTAMP, result ENUM('pending','approved','rejected') DEFAULT 'pending', notes TEXT, FOREIGN KEY (reportID) REFERENCES reports(reportID) ON DELETE CASCADE, FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE, FOREIGN KEY (adminId) REFERENCES admins(adminId) ON DELETE SET NULL ); -- Notifications CREATE TABLE notifications ( notificationId INT AUTO_INCREMENT PRIMARY KEY, userId INT, message TEXT, createdAt DATETIME DEFAULT CURRENT_TIMESTAMP, readFlag TINYINT(1) DEFAULT 0, FOREIGN KEY (userId) REFERENCES users(userId) ON DELETE CASCADE ); -- Claims (owners claiming items) CREATE TABLE claims ( claimId INT AUTO_INCREMENT PRIMARY KEY, itemID INT, ownerUserId INT, proofPath VARCHAR(255), status ENUM('pending','approved','rejected') DEFAULT 'pending', createdAt DATETIME DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (itemID) REFERENCES items(itemID) ON DELETE CASCADE, FOREIGN KEY (ownerUserId) REFERENCES users(userId) ON DELETE CASCADE ); -- Sample data INSERT INTO admins (username, passwordHash, name) VALUES ('admin', '$2y$10$rA8U5s2vV1cQbE9wXyZzKuOaMbNcRe3tYv6B8dC7eF0gH1iJ2kL', 'System Administrator'); INSERT INTO users (name, email, passwordHash, role) VALUES ('Alice Finder', 'alice.finder@example.com', '$2y$10$aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcdef', 'finder'), ('Bob Owner', 'bob.owner@example.com', '$2y$10$zYxWvUtSrQpOnMlKjIhGfEdCbA9876543210zyxwvu', 'owner'); INSERT INTO storage_locations (name, address, contactInfo) VALUES ('Main Lost & Found Center','123 Central Ave, City','+267 123 4567'); INSERT INTO reports (userId, locationFound, notes) VALUES (1, 'Library - 2nd Floor', 'Small black backpack near the study tables.'); INSERT INTO items (reportID, description, category, status, storageLocationID, imagePath) VALUES (1, 'Black backpack with red zipper and keychain', 'Bags', 'stored', 1, 'uploads/black_backpack.jpg'); INSERT INTO verifications (reportID, itemID, adminId, result, notes) VALUES (1, 1, 1, 'approved', 'Item verified and stored properly.'); INSERT INTO claims (itemID, ownerUserId, status) VALUES (1, 2, 'pending'); INSERT INTO notifications (userId, message) VALUES (1, 'Your report #1 has been verified and approved.'), (2, 'Your claim for Black backpack is pending review.'); ```