-- Photo Galleries Table
CREATE TABLE IF NOT EXISTS photo_galleries (
  id INT PRIMARY KEY AUTO_INCREMENT,
  title VARCHAR(255) NOT NULL,
  slug VARCHAR(255) UNIQUE NOT NULL,
  description TEXT,
  cover_image VARCHAR(255),
  status ENUM('active', 'inactive') DEFAULT 'active',
  display_order INT DEFAULT 0,
  views INT DEFAULT 0,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  INDEX idx_slug (slug),
  INDEX idx_status (status),
  INDEX idx_display_order (display_order)
);

-- Gallery Photos Table
CREATE TABLE IF NOT EXISTS gallery_photos (
  id INT PRIMARY KEY AUTO_INCREMENT,
  gallery_id INT NOT NULL,
  photo_url VARCHAR(255) NOT NULL,
  title VARCHAR(255),
  description TEXT,
  display_order INT DEFAULT 0,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (gallery_id) REFERENCES photo_galleries(id) ON DELETE CASCADE,
  INDEX idx_gallery_id (gallery_id),
  INDEX idx_display_order (display_order)
);

-- Sample Data
INSERT INTO photo_galleries (title, slug, description, status, display_order) VALUES
('2 Şubat 2026 Umre Programı', '2-subat-2026-umre-programi', 'Şubat ayı umre programı fotoğrafları', 'active', 1),
('29 Ocak Umre Programı', '29-ocak-umre-programi', 'Ocak ayı umre programı fotoğrafları', 'active', 2);
