-- Media Hub Database Schema
CREATE DATABASE IF NOT EXISTS media_hub;
USE media_hub;

-- Create media items table
CREATE TABLE IF NOT EXISTS media_items (
    id INT AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    type ENUM('audio', 'music-videos', 'ai-videos') NOT NULL,
    url TEXT NOT NULL,
    description TEXT,
    duration VARCHAR(20),
    tags JSON,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_type (type),
    INDEX idx_created_at (created_at)
);

-- Insert sample data
INSERT INTO media_items (title, type, url, description, duration, tags) VALUES
('E Minor Backing Track', 'audio', '/guitar/backing_tracks/E Minor Beautiful Soft Backing Track Loop 1080p(1).mp3', 'Perfect for practice sessions and improvisation', '3:45', '["guitar", "backing-track", "e-minor", "practice"]'),
('Project Showcase', 'music-videos', '/cyberpunk.mp4', 'Cyberpunk-themed project demonstration', '2:15', '["cyberpunk", "demo", "project"]'),
('AI Generated Content', 'ai-videos', 'placeholder', 'AI-generated video content placeholder', '1:30', '["ai", "generated", "placeholder"]');