-- Seed Data for Learning Paths
-- Path 1: Pre-Security Fundamentals

-- Insert Learning Path
INSERT INTO learning_paths (title, description, difficulty_level, estimated_hours, display_order) VALUES
('Pre-Security Fundamentals', 'Start your cybersecurity journey with essential IT and security foundations. Perfect for absolute beginners.', 'beginner', 120, 1);

-- Get the ID (assuming it's 1 for first insert)
SET @path_id = LAST_INSERT_ID();

-- Insert Modules (Rooms)
INSERT INTO modules (learning_path_id, title, description, estimated_hours, display_order, prerequisite_module_id) VALUES
(@path_id, 'Introduction to Cybersecurity', 'Learn what cybersecurity is, why it matters, and explore career paths in the field.', 15, 1, NULL),
(@path_id, 'Linux Fundamentals', 'Master the Linux command line, file permissions, and basic system administration.', 25, 2, NULL),
(@path_id, 'Windows Fundamentals', 'Understand Windows operating systems, Active Directory basics, and PowerShell.', 25, 3, NULL),
(@path_id, 'Networking Essentials', 'Learn the OSI model, TCP/IP, subnetting, and common network protocols.', 30, 4, NULL),
(@path_id, 'Security Principles', 'Understand the CIA Triad, AAA framework, and fundamental security concepts.', 15, 5, NULL),
(@path_id, 'Command Line Mastery', 'Advanced command-line techniques with grep, sed, awk, and scripting basics.', 10, 6, 2);

-- Insert Tasks for Module 1: Introduction to Cybersecurity
SET @module1_id = (SELECT id FROM modules WHERE title = 'Introduction to Cybersecurity' AND learning_path_id = @path_id);

INSERT INTO tasks (module_id, title, description, task_type, xp_reward, display_order) VALUES
(@module1_id, 'What is Cybersecurity?', 'Read about cybersecurity fundamentals, the CIA Triad, and why security matters in the digital age.', 'reading', 20, 1),
(@module1_id, 'Understanding Threats and Vulnerabilities', 'Learn the difference between threats, vulnerabilities, and risks. Explore common attack vectors.', 'reading', 30, 2),
(@module1_id, 'Career Paths in Cybersecurity', 'Discover different career paths: SOC Analyst, Penetration Tester, Security Engineer, and more.', 'reading', 20, 3),
(@module1_id, 'Quiz: Cybersecurity Basics', 'Test your knowledge of fundamental cybersecurity concepts.', 'quiz', 50, 4),
(@module1_id, 'Setting Up Your Lab Environment', 'Install VirtualBox and download your first security-focused Linux distribution.', 'challenge', 100, 5);

-- Insert Tasks for Module 2: Linux Fundamentals
SET @module2_id = (SELECT id FROM modules WHERE title = 'Linux Fundamentals' AND learning_path_id = @path_id);

INSERT INTO tasks (module_id, title, description, task_type, xp_reward, display_order) VALUES
(@module2_id, 'Navigating the File System', 'Learn cd, ls, pwd commands. Practice moving through directories.', 'challenge', 40, 1),
(@module2_id, 'File Manipulation', 'Master cp, mv, rm, mkdir, touch commands for managing files and directories.', 'challenge', 40, 2),
(@module2_id, 'Understanding Permissions', 'Learn about user, group, and other permissions using chmod and chown.', 'reading', 50, 3),
(@module2_id, 'Searching and Finding Files', 'Use find, locate, and which commands to search for files.', 'challenge', 40, 4),
(@module2_id, 'Text Manipulation with grep', 'Learn to search file contents using grep with regular expressions.', 'challenge', 50, 5),
(@module2_id, 'Process Management', 'Understand ps, top, kill commands for managing running processes.', 'challenge', 50, 6),
(@module2_id, 'Package Management', 'Install and manage software using apt/yum package managers.', 'challenge', 40, 7),
(@module2_id, 'Linux Challenge Lab', 'Complete a comprehensive Linux challenge combining all learned skills.', 'challenge', 100, 8);

-- Insert Tasks for Module 3: Windows Fundamentals
SET @module3_id = (SELECT id FROM modules WHERE title = 'Windows Fundamentals' AND learning_path_id = @path_id);

INSERT INTO tasks (module_id, title, description, task_type, xp_reward, display_order) VALUES
(@module3_id, 'Windows File System', 'Understand the Windows directory structure, drives, and file paths.', 'reading', 30, 1),
(@module3_id, 'User Account Management', 'Learn about Windows user accounts, groups, and local security policies.', 'reading', 40, 2),
(@module3_id, 'PowerShell Basics', 'Introduction to PowerShell cmdlets, variables, and basic scripting.', 'challenge', 50, 3),
(@module3_id, 'Windows Services', 'Understand Windows services, how to start/stop them, and their security implications.', 'challenge', 40, 4),
(@module3_id, 'Active Directory Introduction', 'Learn about Active Directory, domains, domain controllers, and organizational units.', 'reading', 50, 5),
(@module3_id, 'Windows Event Logs', 'Explore Windows Event Viewer and understand Security, Application, and System logs.', 'challenge', 60, 6),
(@module3_id, 'Windows Registry Basics', 'Understand the Windows Registry structure and common security-related keys.', 'reading', 40, 7),
(@module3_id, 'Windows Investigation Challenge', 'Analyze a simulated compromised Windows system to find indicators of compromise.', 'challenge', 100, 8);

-- Insert Tasks for Module 4: Networking Essentials
SET @module4_id = (SELECT id FROM modules WHERE title = 'Networking Essentials' AND learning_path_id = @path_id);

INSERT INTO tasks (module_id, title, description, task_type, xp_reward, display_order) VALUES
(@module4_id, 'OSI Model Explained', 'Learn the 7 layers of the OSI model and their functions.', 'reading', 40, 1),
(@module4_id, 'TCP/IP Protocol Suite', 'Understand TCP vs UDP, common ports, and the three-way handshake.', 'reading', 50, 2),
(@module4_id, 'IP Addressing and Subnetting', 'Learn IPv4 addressing, subnet masks, and CIDR notation.', 'challenge', 60, 3),
(@module4_id, 'Subnetting Practice', 'Complete subnetting exercises to master network calculations.', 'challenge', 70, 4),
(@module4_id, 'DNS Fundamentals', 'Understand how DNS works, record types (A, AAAA, MX, CNAME), and DNS queries.', 'reading', 50, 5),
(@module4_id, 'DHCP and ARP', 'Learn how DHCP assigns IP addresses and how ARP maps IPs to MAC addresses.', 'reading', 40, 6),
(@module4_id, 'Common Network Protocols', 'Explore HTTP/HTTPS, FTP, SSH, SMTP, and their security implications.', 'reading', 50, 7),
(@module4_id, 'Wireshark Introduction', 'Capture and analyze network traffic using Wireshark.', 'challenge', 70, 8),
(@module4_id, 'Network Traffic Analysis Challenge', 'Analyze a PCAP file to identify suspicious network activity.', 'challenge', 100, 9),
(@module4_id, 'Quiz: Networking Essentials', 'Test your networking knowledge with a comprehensive quiz.', 'quiz', 60, 10);

-- Insert Badges
INSERT INTO badges (name, description, badge_type, xp_reward) VALUES
('First Steps', 'Completed your first task in the learning path', 'milestone', 50),
('Linux Novice', 'Completed the Linux Fundamentals module', 'path_completion', 200),
('Windows Explorer', 'Completed the Windows Fundamentals module', 'path_completion', 200),
('Network Navigator', 'Completed the Networking Essentials module', 'path_completion', 200),
('Security Foundations', 'Completed the Pre-Security Fundamentals path', 'path_completion', 500);
