CREATE TABLE `banners` (
  `id` varchar(36) NOT NULL,
  `food_court_id` varchar(36) NOT NULL,
  `restaurant_id` varchar(36) NOT NULL,
  `placement` enum('court','restaurant') NOT NULL DEFAULT 'court',
  `title` varchar(160) NOT NULL,
  `title_ar` varchar(160) DEFAULT NULL,
  `subtitle` varchar(240) DEFAULT NULL,
  `subtitle_ar` varchar(240) DEFAULT NULL,
  `image_url` varchar(500) NOT NULL,
  `target_type` enum('restaurant','category','item') NOT NULL,
  `target_id` varchar(36) NOT NULL,
  `is_active` tinyint NOT NULL DEFAULT 1,
  `sort_order` int NOT NULL DEFAULT 0,
  `created_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `updated_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
  PRIMARY KEY (`id`),
  KEY `IDX_banners_public_order` (`food_court_id`, `placement`, `is_active`, `sort_order`),
  KEY `IDX_banners_restaurant` (`restaurant_id`, `placement`, `is_active`, `sort_order`),
  CONSTRAINT `FK_banners_food_court`
    FOREIGN KEY (`food_court_id`) REFERENCES `food_courts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `FK_banners_restaurant`
    FOREIGN KEY (`restaurant_id`) REFERENCES `restaurants` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
