import { VideoItem, HomeSection } from "@/types/home";

const MOCK_THUMBNAILS = [
  "https://picsum.photos/seed/vid1/400/225",
  "https://picsum.photos/seed/vid2/400/225",
  "https://picsum.photos/seed/vid3/400/225",
  "https://picsum.photos/seed/vid4/400/225",
  "https://picsum.photos/seed/vid5/400/225",
  "https://picsum.photos/seed/vid6/400/225",
  "https://picsum.photos/seed/vid7/400/225",
  "https://picsum.photos/seed/vid8/400/225",
  "https://picsum.photos/seed/vid9/400/225",
  "https://picsum.photos/seed/vid10/400/225",
  "https://picsum.photos/seed/vid11/400/225",
  "https://picsum.photos/seed/vid12/400/225",
];

const MOCK_CHANNELS = [
  "Doliplay Originals",
  "Tech Universe",
  "Comedy Central IN",
  "Music Vibes",
  "Travel Stories",
  "Fitness Hub",
  "News Today",
  "Bollywood Updates",
];

const MOCK_TITLES = [
  "The Ultimate Guide to Modern Web Development",
  "Top 10 Comedy Sketches of 2025",
  "Bollywood's Best Music Videos This Year",
  "Travel Vlog: Hidden Gems of Rajasthan",
  "30-Day Workout Challenge | Full Body",
  "Breaking News: Technology Trends 2025",
  "Behind the Scenes: Movie Magic",
  "Street Food Tour: Mumbai Edition",
  "How to Master React in 2025",
  "Documentary: The Ocean's Mystery",
  "Live Concert Highlights — Summer 2025",
  "Cooking Masterclass: Indian Cuisine",
];

export function generateMockVideos(count = 12, category = "all"): VideoItem[] {
  return Array.from({ length: count }, (_, i) => ({
    id: `video-${category}-${i + 1}`,
    title: MOCK_TITLES[i % MOCK_TITLES.length],
    thumbnail: MOCK_THUMBNAILS[i % MOCK_THUMBNAILS.length],
    duration: `${Math.floor(Math.random() * 20) + 3}:${String(Math.floor(Math.random() * 60)).padStart(2, "0")}`,
    views: `${(Math.floor(Math.random() * 900) + 100).toLocaleString()}K`,
    uploadedAt: `${Math.floor(Math.random() * 30) + 1}d ago`,
    channelName: MOCK_CHANNELS[i % MOCK_CHANNELS.length],
    channelAvatar: `https://picsum.photos/seed/ch${i}/40/40`,
    category,
    type: i % 4 === 0 ? "short" : i % 5 === 0 ? "music" : "video",
    isPremium: i % 7 === 0,
    isNew: i % 5 === 1,
  }));
}

export function generateMockSections(tab = "all"): HomeSection[] {
  return [
    {
      id: "trending",
      title: "Trending Now",
      type: "trending",
      items: generateMockVideos(8, tab),
    },
    {
      id: "recommended",
      title: "Recommended for You",
      type: "recommended",
      items: generateMockVideos(8, tab),
    },
  ];
}
