-- Üst menü öğeleri (Navbar). Varsayılanlar mevcut sabit menüyle uyumludur.
USE faunamix;

CREATE TABLE IF NOT EXISTS nav_menu_items (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  sort_order INT NOT NULL DEFAULT 0,
  title VARCHAR(128) NOT NULL,
  url VARCHAR(512) NOT NULL,
  open_new_tab TINYINT(1) NOT NULL DEFAULT 0,
  is_active TINYINT(1) NOT NULL DEFAULT 1,
  variant ENUM('link', 'button') NOT NULL DEFAULT 'link',
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  KEY idx_nav_sort (sort_order, id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO nav_menu_items (sort_order, title, url, open_new_tab, is_active, variant)
SELECT v.sort_order, v.title, v.url, v.open_new_tab, v.is_active, v.variant
FROM (
  SELECT 0 AS sort_order, 'Ürünler' AS title, '/listing' AS url, 0 AS open_new_tab, 1 AS is_active, 'link' AS variant
  UNION ALL SELECT 1, 'Hakkımızda', '/hakkimizda', 0, 1, 'link'
  UNION ALL SELECT 2, 'İletişim', 'mailto:hello@faunamix.example?subject=İletişim', 0, 1, 'button'
) AS v
WHERE (SELECT COUNT(*) FROM nav_menu_items) = 0;
