-- ============================================================
-- Music Genre Classification
-- ============================================================
-- Adds per-track genre to download_items so users can filter
-- workout music by genre preference.

-- Genre enum values: edm, hip-hop, pop, rock, latin, house,
-- drum-and-bass, dubstep, r-and-b, country, metal, ambient

ALTER TABLE public.download_items
  ADD COLUMN IF NOT EXISTS genre TEXT
    CHECK (genre IS NULL OR genre IN (
      'edm', 'hip-hop', 'pop', 'rock', 'latin', 'house',
      'drum-and-bass', 'dubstep', 'r-and-b', 'country', 'metal', 'ambient'
    ));

CREATE INDEX IF NOT EXISTS idx_download_items_genre
  ON public.download_items(genre);
