// Realistic CS2-themed mock data. Replace with REST calls later.
import type {
  GameServer, Player, Punishment, StoreProduct, NewsArticle,
  RankingEntry, Notification, PlatformStats,
} from "@/types";

export const stats: PlatformStats = {
  totalPlayers: 48219,
  onlineWebsite: 312,
  onlineServers: 1874,
  totalServers: 24,
  activeServers: 21,
  totalBans: 3812,
  activeBans: 214,
  totalMutes: 1902,
  activeMutes: 78,
  roundsPlayed: 1_284_991,
  totalPurchases: 9247,
};

const maps = ["de_mirage", "de_dust2", "de_inferno", "de_nuke", "de_ancient", "de_anubis", "de_vertigo", "de_overpass"];
const modes = ["Competitive 5v5", "Retakes", "Deathmatch", "Executes", "1v1 Arena", "Surf", "KZ", "AWP Only"];
const regions = ["EU-West", "EU-East", "NA-East", "NA-West", "SA", "Asia"];

export const servers: GameServer[] = Array.from({ length: 12 }, (_, i) => ({
  id: `srv-${i + 1}`,
  name: [`Purple Zone #${i + 1} — ${modes[i % modes.length]}`][0],
  ip: `185.204.${20 + i}.${100 + i}`,
  port: 27015 + i,
  mode: modes[i % modes.length],
  map: maps[i % maps.length],
  nextMap: maps[(i + 1) % maps.length],
  region: regions[i % regions.length],
  players: 6 + ((i * 3) % 20),
  maxPlayers: 20,
  ping: 12 + (i * 7) % 60,
  tickrate: 128,
  status: i === 3 ? "maintenance" : i === 7 ? "offline" : "online",
  ctScore: (i * 3) % 16,
  tScore: (i * 5) % 16,
  timeRemaining: `${(i * 2) % 45}:${((i * 13) % 60).toString().padStart(2, "0")}`,
  uptime: `${(i + 1) * 3}d ${(i * 5) % 24}h`,
  passwordProtected: i === 9,
}));

export const players: Player[] = Array.from({ length: 24 }, (_, i) => ({
  id: `p-${i + 1}`,
  steamId: `7656119${(80000000 + i * 137).toString().padStart(10, "0")}`,
  name: ["v1p3r", "Nyxa", "s1lentwolf", "PurpleReign", "K1NG_Ash", "M3lodyOf.Fire", "ghostbyte", "n0va", "Zephyr", "Kai.exe", "Sable", "Rune", "Vex", "Orion", "Lyric", "0xShade", "Ember", "Cobalt", "Vale", "Rho", "Nyra", "Sol", "Kestrel", "Wren"][i],
  country: ["DE", "PL", "FR", "US", "BR", "SE", "UA", "GB", "ES", "NL", "CA", "TR"][i % 12],
  avatar: `https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${i}`,
  rank: ["Global Elite", "Supreme", "LEM", "DMG", "MG2", "MG1", "MGE", "GN Master"][i % 8],
  level: 100 - i * 3,
  rating: (1.5 - i * 0.03).toFixed(2),
  kills: 24500 - i * 812,
  deaths: 18700 - i * 620,
  kd: ((24500 - i * 812) / (18700 - i * 620)).toFixed(2),
  headshotPct: 62 - i,
  mvps: 1820 - i * 45,
  wins: 1420 - i * 32,
  playtimeHours: 2100 - i * 55,
  onlineStatus: i % 3 === 0 ? "online" : i % 3 === 1 ? "offline" : "in-server",
  currentServer: i % 3 === 2 ? servers[i % servers.length].name : null,
  privileges: i % 5 === 0 ? ["VIP"] : i % 7 === 0 ? ["Premium", "Veteran"] : i === 0 ? ["Admin"] : [],
  lastSeen: `${i + 1}h ago`,
}));

export const punishments: Punishment[] = Array.from({ length: 10 }, (_, i) => ({
  id: `pn-${1000 + i}`,
  playerName: players[i].name,
  playerId: players[i].id,
  steamId: players[i].steamId,
  type: (["ban", "mute", "gag", "silence", "warning"] as const)[i % 5],
  reason: ["Wallhack", "Toxic behavior", "Spam microphone", "Team damage", "Cheating suspicion", "Racism", "Advertising", "Griefing", "Aimbot", "Ban evasion"][i],
  admin: "PurpleAdmin",
  server: servers[i % servers.length].name,
  issuedAt: `2026-07-${(20 - i).toString().padStart(2, "0")}`,
  expiresAt: i % 3 === 0 ? "Permanent" : `2026-08-${(1 + i).toString().padStart(2, "0")}`,
  duration: i % 3 === 0 ? "Permanent" : `${(i + 1) * 3}d`,
  remaining: i % 3 === 0 ? "—" : `${5 - (i % 5)}d`,
  status: (i % 4 === 0 ? "active" : i % 4 === 1 ? "expired" : i % 4 === 2 ? "appealed" : "active") as Punishment["status"],
  hasEvidence: i % 2 === 0,
}));

export const products: StoreProduct[] = [
  { id: "vip-30", name: "VIP — 30 days", category: "VIP", price: 4.99, oldPrice: 6.99, image: "🛡️", description: "Priority slot, +5% XP, chat colors.", duration: "30 days", featured: true, popular: true },
  { id: "prem-30", name: "Premium — 30 days", category: "Premium", price: 9.99, image: "💎", description: "All VIP perks + custom tag + reserved slot.", duration: "30 days", featured: true },
  { id: "prem-perm", name: "Premium — Permanent", category: "Premium", price: 79.99, oldPrice: 99.99, image: "👑", description: "Lifetime Premium across all servers.", duration: "Permanent", popular: true },
  { id: "slot", name: "Reserved Slot", category: "Utility", price: 3.49, image: "🎟️", description: "Never wait to join a full server.", duration: "30 days" },
  { id: "tag", name: "Custom Chat Tag", category: "Cosmetic", price: 2.49, image: "🏷️", description: "Personal colored tag in chat.", duration: "30 days" },
  { id: "xp", name: "XP Boost 2x", category: "Boost", price: 1.99, image: "⚡", description: "Double experience for 7 days.", duration: "7 days" },
  { id: "bal-10", name: "10 credits", category: "Balance", price: 9.99, image: "💰", description: "Top up your account wallet.", duration: "—" },
  { id: "bundle", name: "Ultimate Bundle", category: "Bundle", price: 29.99, oldPrice: 44.99, image: "🎁", description: "VIP + XP Boost + Custom Tag + Slot.", duration: "30 days", featured: true },
];

export const news: NewsArticle[] = [
  { id: "n1", slug: "season-5-launch", title: "Season 5 launches with fresh maps and new ranks", category: "Announcement", excerpt: "New competitive season is live with reworked ranking, seasonal rewards, and two brand new maps.", cover: "🎯", author: "Nyxa", date: "2026-07-18", readMin: 4, views: 12480 },
  { id: "n2", slug: "anti-cheat-update", title: "Anti-cheat v3 rolled out across all servers", category: "Update", excerpt: "We deployed our upgraded anti-cheat with stricter detection and faster ban response.", cover: "🛡️", author: "Admin Team", date: "2026-07-14", readMin: 6, views: 8340 },
  { id: "n3", slug: "summer-sale", title: "Summer sale — up to 40% off all privileges", category: "Store", excerpt: "Grab Premium and VIP at their lowest prices of the year until August 3rd.", cover: "🔥", author: "Store", date: "2026-07-10", readMin: 2, views: 15922 },
  { id: "n4", slug: "tournament-recap", title: "Community Cup #12 recap and highlights", category: "Events", excerpt: "PurpleReign takes the crown after a nail-biting overtime final against Team Nyx.", cover: "🏆", author: "v1p3r", date: "2026-07-06", readMin: 8, views: 6210 },
];

export const rankings: RankingEntry[] = players
  .slice()
  .sort((a, b) => Number(b.rating) - Number(a.rating))
  .map((p, i) => ({
    position: i + 1,
    change: (i % 3) - 1,
    player: p,
    rating: Number(p.rating),
    points: 3200 - i * 87,
  }));

export const notifications: Notification[] = [
  { id: "nt1", type: "message", title: "Nyxa sent you a message", body: "gg wp last match", time: "2m", read: false },
  { id: "nt2", type: "purchase", title: "Purchase completed", body: "VIP — 30 days activated", time: "1h", read: false },
  { id: "nt3", type: "expiry", title: "Premium expires in 3 days", body: "Renew to keep your perks", time: "5h", read: true },
  { id: "nt4", type: "punishment", title: "Appeal update", body: "Your appeal is under review", time: "1d", read: true },
];
