-- Home Page Sliders Table
-- This table stores promotional sliders/banners for the home page
-- Each slider can have a redirect link for navigation

CREATE TABLE IF NOT EXISTS `home_sliders` (
  `id` INT PRIMARY KEY AUTO_INCREMENT,
  `title` VARCHAR(255) NOT NULL COMMENT 'Slider title',
  `description` TEXT COMMENT 'Slider description',
  `image_url` VARCHAR(1000) NOT NULL COMMENT 'Slider image URL',
  `link_type` ENUM('course', 'institute', 'video', 'external', 'internal') DEFAULT 'internal' COMMENT 'Type of link',
  `link_value` VARCHAR(500) COMMENT 'Link destination (course_id, institute_id, url, etc)',
  `display_order` INT DEFAULT 0 COMMENT 'Display order (lower number = higher priority)',
  `is_active` TINYINT(1) DEFAULT 1 COMMENT 'Active status',
  `start_date` TIMESTAMP NULL COMMENT 'Slider start date',
  `end_date` TIMESTAMP NULL COMMENT 'Slider end date',
  `button_text` VARCHAR(100) DEFAULT 'Learn More' COMMENT 'CTA button text',
  `background_color` VARCHAR(20) DEFAULT '#6366f1' COMMENT 'Background color for gradient',
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  KEY `idx_active` (`is_active`),
  KEY `idx_order` (`display_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci 
COMMENT='Home page promotional sliders with links';

-- Insert sample sliders
INSERT INTO `home_sliders` (`title`, `description`, `image_url`, `link_type`, `link_value`, `display_order`, `is_active`, `button_text`, `background_color`) 
VALUES 
  ('Welcome to Ashlya Academy', 'Start your learning journey with our expert courses', 'https://images.unsplash.com/photo-1522202176988-66273c2fd55f?w=800', 'internal', '/courses', 1, 1, 'Explore Courses', '#6366f1'),
  ('Grade 11 Physics Course', 'Master Physics with CLC Sir - Comprehensive video lectures', 'https://images.unsplash.com/photo-1635070041078-e363dbe005cb?w=800', 'course', '8', 2, 1, 'Enroll Now', '#10b981'),
  ('Join Live Classes', 'Interactive live sessions with expert instructors', 'https://images.unsplash.com/photo-1588072432836-e10032774350?w=800', 'internal', '/live-classes', 3, 1, 'Join Now', '#f59e0b')
ON DUPLICATE KEY UPDATE updated_at = CURRENT_TIMESTAMP;
