-- ============================================================
-- NEOMORPH PLAYER – Setup Database
-- Import file ini ke phpMyAdmin untuk inisialisasi database
-- ============================================================

-- Buat database
CREATE DATABASE IF NOT EXISTS `music_player_db`
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

USE `music_player_db`;

-- ============================================================
-- Tabel: songs
-- ============================================================
CREATE TABLE IF NOT EXISTS `songs` (
  `id`           INT          NOT NULL AUTO_INCREMENT,
  `title`        VARCHAR(255) NOT NULL,
  `artist`       VARCHAR(255) NOT NULL DEFAULT '',
  `album`        VARCHAR(255) NOT NULL DEFAULT '',
  `genre`        VARCHAR(100) NOT NULL DEFAULT 'Lainnya',
  `duration`     VARCHAR(10)  NOT NULL DEFAULT '0:00',
  `duration_sec` INT          NOT NULL DEFAULT 0,
  `src`          VARCHAR(500) NOT NULL DEFAULT '',
  `image`        VARCHAR(500) NOT NULL DEFAULT '',
  `color1`       VARCHAR(7)   NOT NULL DEFAULT '#7c5cbf',
  `color2`       VARCHAR(7)   NOT NULL DEFAULT '#e44d7b',
  `sort_order`   INT          NOT NULL DEFAULT 0,
  `created_at`   TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================================
-- Data awal: 8 lagu demo (sama dengan DEFAULT_PLAYLIST di JS)
-- ============================================================
INSERT IGNORE INTO `songs`
  (`id`, `title`, `artist`, `album`, `genre`, `duration`, `duration_sec`, `src`, `image`, `color1`, `color2`, `sort_order`)
VALUES
  (1, 'Neon Dreams',    'Synthwave Studio',  'Digital Horizons', 'Synthwave',  '3:42', 222, 'assets/music/song1.mp3', '', '#7c5cbf', '#e44d7b', 1),
  (2, 'Midnight Pulse', 'Luna Beats',        'Dark Frequency',   'Electronic', '4:15', 255, 'assets/music/song2.mp3', '', '#06b6d4', '#3b82f6', 2),
  (3, 'Golden Hour',    'Aria Waves',        'Sunset Sessions',  'Chill',      '3:58', 238, 'assets/music/song3.mp3', '', '#f59e0b', '#ef4444', 3),
  (4, 'Cosmic Journey', 'Stellar Sound',     'Universe',         'Ambient',    '5:20', 320, 'assets/music/song4.mp3', '', '#8b5cf6', '#06b6d4', 4),
  (5, 'Urban Flow',     'City Beats',        'Metropolitan',     'Hip-Hop',    '3:30', 210, 'assets/music/song5.mp3', '', '#10b981', '#3b82f6', 5),
  (6, 'Tropical Breeze','Island Groove',     'Paradise',         'Pop',        '2:55', 175, 'assets/music/song6.mp3', '', '#f97316', '#eab308', 6),
  (7, 'Deep Space',     'Nebula Orchestra',  'Infinity',         'Orchestral', '6:10', 370, 'assets/music/song7.mp3', '', '#1d4ed8', '#7c3aed', 7),
  (8, 'Electric Soul',  'Voltage Band',      'Power Surge',      'Rock',       '4:02', 242, 'assets/music/song8.mp3', '', '#dc2626', '#ea580c', 8);
