CREATE TABLE IF NOT EXISTS menu_items (
  id INT AUTO_INCREMENT PRIMARY KEY,
  label VARCHAR(100) NOT NULL,
  url VARCHAR(255) NOT NULL,
  position INT DEFAULT 0,
  parent_id INT DEFAULT NULL,
  is_active TINYINT(1) DEFAULT 1,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  FOREIGN KEY (parent_id) REFERENCES menu_items(id) ON DELETE CASCADE,
  INDEX idx_position (position),
  INDEX idx_active (is_active)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Insert default menu items
INSERT IGNORE INTO menu_items (id, label, url, position, is_active) VALUES
(1, 'Home', '/', 0, 1),
(2, 'About', '/about', 1, 1),
(3, 'Services', '/services', 2, 1),
(4, 'Projects', '/projects', 3, 1),
(5, 'Careers', '/careers', 4, 1),
(6, 'Contact', '/contact', 5, 1);
