-- Menuboard Slider - Veritabanı Şeması
-- MySQL 5.7+ ve 8.0+ uyumlu

-- Veritabanı oluştur (varsa sil)
DROP DATABASE IF EXISTS `menuboard_slider`;
CREATE DATABASE `menuboard_slider` 
  CHARACTER SET utf8mb4 
  COLLATE utf8mb4_unicode_ci;

USE `menuboard_slider`;

-- Slider öğeleri tablosu
CREATE TABLE `sliders` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `title` VARCHAR(255),
  `media_type` ENUM('image', 'video') NOT NULL,
  `media_url` VARCHAR(500) NOT NULL,
  `duration` INT DEFAULT 7 COMMENT 'Saniye cinsinden, sadece image için',
  `sort_order` INT DEFAULT 0,
  `is_active` TINYINT(1) DEFAULT 1,
  `screen_key` VARCHAR(100) COMMENT 'Çoklu ekran filtrelemesi için',
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  INDEX `idx_is_active` (`is_active`),
  INDEX `idx_sort_order` (`sort_order`),
  INDEX `idx_screen_key` (`screen_key`),
  INDEX `idx_media_type` (`media_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Örnek slider öğeleri
INSERT INTO `sliders` (`title`, `media_type`, `media_url`, `duration`, `sort_order`, `is_active`, `screen_key`) VALUES 
('Örnek Görsel 1', 'image', '/uploads/sliders/example1.jpg', 7, 1, 1, NULL),
('Örnek Video 1', 'video', '/uploads/sliders/example1.mp4', 0, 2, 1, NULL),
('Örnek Görsel 2', 'image', '/uploads/sliders/example2.jpg', 5, 3, 1, NULL);
