

CREATE TABLE IF NOT EXISTS tasks (
    id INT AUTO_INCREMENT PRIMARY KEY,
    userId INT NOT NULL,
    title VARCHAR(255) NOT NULL,
    date VARCHAR(50),
    time VARCHAR(50),
    dueDate VARCHAR(50),
    status ENUM('todo', 'in_progress', 'completed') DEFAULT 'todo',
    completed BOOLEAN DEFAULT FALSE,
     summaries JSON DEFAULT '[]',
    FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS leaves (
    id INT AUTO_INCREMENT PRIMARY KEY,
    userId INT NOT NULL,
    name VARCHAR(100) NOT NULL,
    date VARCHAR(50) NOT NULL,
    reason VARCHAR(255) NOT NULL,
    status VARCHAR(50) DEFAULT 'Pending',
    FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
);

-- Sample data for tasks
INSERT INTO tasks (userId, title, date, time, dueDate, status, completed) VALUES
(1, 'Sample Task', '2024-06-01', '10:00', '2024-06-05', 'todo', false);

-- Sample data for leaves
INSERT INTO leaves (userId, name, date, reason, status) VALUES
(1, 'Alice Example', '2024-06-02', 'Medical', 'Pending');
