-- Initial Database State Script

-- Insert Administrators
INSERT INTO administrator (idAdministrator) VALUES
(1),
(2),
(3); -- Added more administrators

-- Insert User Inpulse (some pending)
INSERT INTO user_inpulse (idUser, userSurname, userName, primaryMail, secondaryMail, phoneNumber, pending) VALUES
(1, 'Doe', 'John', 'john.doe@example.com', NULL, '123-456-7890', FALSE),
(2, 'Smith', 'Jane', 'jane.smith@example.com', 'jane.s@altmail.com', '987-654-3210', FALSE),
(3, 'Williams', 'Peter', 'peter.w@example.com', NULL, NULL, TRUE), -- Pending user
(4, 'Jones', 'Mary', 'mary.j@example.com', NULL, '555-123-4567', FALSE),
(5, 'Brown', 'Michael', 'michael.b@example.com', 'mike.brown@work.com', '111-222-3333', FALSE),
(6, 'Garcia', 'Maria', 'maria.g@example.com', NULL, '444-555-6666', TRUE), -- Another pending user
(7, 'Miller', 'David', 'david.m@example.com', NULL, '777-888-9999', FALSE);

-- Insert Entrepreneurs
INSERT INTO entrepreneur (idEntrepreneur, school, course, sneeStatus, idProjectParticipation, idProjectProposed, idMakeAppointment) VALUES
(1, 'Business School A', 'MBA', TRUE, NULL, NULL, NULL),
(2, 'Tech University B', 'Computer Science', FALSE, NULL, NULL, NULL),
(3, 'Art Institute C', 'Graphic Design', TRUE, NULL, NULL, NULL),
(4, 'Science College D', 'Biology', FALSE, NULL, NULL, NULL),
(5, 'Engineering School E', 'Mechanical Engineering', TRUE, NULL, NULL, NULL); -- Added more entrepreneurs

-- Insert Projects
-- Main project
INSERT INTO project (IdProject, projectName, loga, creationDate, projectStatus, pending, idAdministrator, entrepreneurProposed) VALUES
(101, 'Innovative Startup Idea', NULL, '2023-10-26', 'In Progress', FALSE, 1, NULL),
(102, 'Pending Project Alpha', NULL, '2024-01-15', 'Planning', TRUE, 1, NULL), -- Pending project
(103, 'Pending Project Beta', NULL, '2024-02-20', 'Idea Stage', TRUE, NULL, 1), -- Another pending project, proposed by entrepreneur 1
(104, 'E-commerce Platform Development', NULL, '2024-03-10', 'Completed', FALSE, 2, NULL), -- Completed project
(105, 'Mobile App for Education', NULL, '2024-04-01', 'In Progress', FALSE, 3, NULL),
(106, 'Pending Research Proposal', NULL, '2024-04-25', 'Drafting', TRUE, NULL, 4); -- Pending project proposed by entrepreneur 4

-- Link Entrepreneurs to projects (Project Participation and Proposed)
-- Based on the current schema, we'll update the entrepreneur table directly.
-- This might need adjustment based on actual application logic if it's a many-to-many.
UPDATE entrepreneur SET idProjectParticipation = 101 WHERE idEntrepreneur IN (1, 2); -- Entrepreneurs 1 and 2 participate in Project 101
UPDATE entrepreneur SET idProjectParticipation = 104 WHERE idEntrepreneur = 3; -- Entrepreneur 3 participates in Project 104
UPDATE entrepreneur SET idProjectProposed = 103 WHERE idEntrepreneur = 1; -- Entrepreneur 1 proposed Project 103
UPDATE entrepreneur SET idProjectProposed = 106 WHERE idEntrepreneur = 4; -- Entrepreneur 4 proposed Project 106

-- Insert Section Cells for the main project (Project 101) and other projects
INSERT INTO section_cell (idSectionCell, IdReference, sectionid, contentSectionCell, modificationDate, idProject) VALUES
(1001, NULL, 1, 'Initial project description for Project 101.', '2023-10-26 10:00:00', 101),
(1002, 1001, 2, 'Market analysis summary for Project 101.', '2023-10-27 14:30:00', 101),
(1003, NULL, 3, 'Team member profiles for Project 101.', '2023-10-28 09:00:00', 101),
(1004, NULL, 1, 'Project brief for Project 104.', '2024-03-10 11:00:00', 104),
(1005, 1004, 2, 'Technical specifications for Project 104.', '2024-03-15 16:00:00', 104),
(1006, NULL, 1, 'Initial concept for Project 105.', '2024-04-01 09:30:00', 105);

-- Insert Appointments
INSERT INTO appointment (idAppointment, appointmentDate, appointmentTime, appointmentDuration, appointmentPlace, appointmentSubject) VALUES
(2001, '2023-11-05', '11:00:00', '01:00:00', 'Meeting Room A', 'Project 101 Kick-off Meeting'),
(2002, '2023-11-10', '14:00:00', '00:30:00', 'Online', 'Project 101 Follow-up Discussion'),
(2003, '2024-03-20', '10:00:00', '01:30:00', 'Client Office', 'Project 104 Final Review'),
(2004, '2024-04-10', '15:00:00', '00:45:00', 'Video Call', 'Project 105 Initial Sync'); -- Added more appointments

-- Insert Concerns (linking Appointments and Section Cells)
INSERT INTO concern (IdAppointment, idSectionCell) VALUES
(2001, 1001), -- Kick-off meeting concerns section 1001 (Project 101)
(2001, 1002), -- Kick-off meeting concerns section 1002 (Project 101)
(2002, 1002), -- Follow-up concerns section 1002 (Project 101)
(2003, 1004), -- Project 104 review concerns section 1004
(2003, 1005), -- Project 104 review concerns section 1005
(2004, 1006); -- Project 105 sync concerns section 1006

-- Insert Make Appointments (linking Appointments, Administrators, and Entrepreneurs)
INSERT INTO make_appointment (idMakeAppointment, idAppointment, idAdministrator, idEntrepreneur) VALUES
(3001, 2001, 1, 1), -- Admin 1 scheduled appointment 2001 with Entrepreneur 1
(3002, 2001, 1, 2), -- Admin 1 scheduled appointment 2001 with Entrepreneur 2
(3003, 2002, 1, 1), -- Admin 1 scheduled appointment 2002 with Entrepreneur 1
(3004, 2003, 2, 3), -- Admin 2 scheduled appointment 2003 with Entrepreneur 3
(3005, 2004, 3, 5); -- Admin 3 scheduled appointment 2004 with Entrepreneur 5

-- Insert Annotations (linking to Section Cells and Administrators)
INSERT INTO annotation (IdAnnotation, comment, idSectionCell, idAdministrator) VALUES
(4001, 'Needs more detail on market size.', 1002, 1),
(4002, 'Looks good.', 1001, 1),
(4003, 'Confirm technical requirements.', 1005, 2),
(4004, 'Initial thoughts on UI/UX.', 1006, 3); -- Added more annotations

-- Insert Reports (linking to Make Appointments)
INSERT INTO report (IdReport, reportContent, idMakeAppointment) VALUES
(5001, 'Discussed project scope and timelines for Project 101.', 3001),
(5002, 'Reviewed market analysis feedback for Project 101.', 3003),
(5003, 'Final sign-off on Project 104 deliverables.', 3004),
(5004, 'Discussed initial concepts for Project 105.', 3005); -- Added more reports

-- The project ID for the main project is 101.
