/**
 * Friends Mock Data
 * 15 friends, friend requests, recommendations, and activity feed
 */

import type { Friend, FriendRequest, FriendRecommendation, FriendActivity } from '../types/friendsTypes';

// 15 Friends
export const friendsMockData: Friend[] = [
  {
    userId: 'friend-001',
    username: 'Ana Martínez',
    avatar: '/avatars/avatar-1.png',
    rank: 'halach_uinik',
    level: 24,
    xp: 48000,
    mlCoins: 12500,
    lastActive: new Date(),
    friendsSince: new Date('2024-11-10'),
    isOnline: true,
    commonInterests: ['Literatura', 'Detective Textual', 'Crucigrama'],
    mutualFriends: 8,
  },
  {
    userId: 'friend-002',
    username: 'Carlos López',
    avatar: '/avatars/avatar-2.png',
    rank: 'chilan',
    level: 18,
    xp: 32000,
    mlCoins: 8900,
    lastActive: new Date(Date.now() - 1800000),
    friendsSince: new Date('2024-11-15'),
    isOnline: true,
    commonInterests: ['Crucigramas', 'Sopa de Letras'],
    mutualFriends: 5,
  },
  {
    userId: 'friend-003',
    username: 'María García',
    avatar: '/avatars/avatar-3.png',
    rank: 'chilan',
    level: 20,
    xp: 38000,
    mlCoins: 10200,
    lastActive: new Date(Date.now() - 3600000),
    friendsSince: new Date('2024-12-01'),
    isOnline: false,
    commonInterests: ['Literatura', 'Ensayo Argumentativo'],
    mutualFriends: 6,
  },
  {
    userId: 'friend-004',
    username: 'Diego Ramírez',
    avatar: '/avatars/avatar-4.png',
    rank: 'batab',
    level: 15,
    xp: 26000,
    mlCoins: 6700,
    lastActive: new Date(Date.now() - 7200000),
    friendsSince: new Date('2024-12-10'),
    isOnline: false,
    commonInterests: ['Mapa Conceptual', 'Timeline'],
    mutualFriends: 4,
  },
  {
    userId: 'friend-005',
    username: 'Sofia Torres',
    avatar: '/avatars/avatar-5.png',
    rank: 'kukulkan',
    level: 32,
    xp: 78000,
    mlCoins: 24500,
    lastActive: new Date(Date.now() - 14400000),
    friendsSince: new Date('2024-10-20'),
    isOnline: false,
    commonInterests: ['Detective Textual', 'Análisis de Memes', 'Fake News'],
    mutualFriends: 12,
  },
  {
    userId: 'friend-006',
    username: 'Luis Hernández',
    avatar: '/avatars/avatar-6.png',
    rank: 'batab',
    level: 16,
    xp: 28000,
    mlCoins: 7200,
    lastActive: new Date(Date.now() - 21600000),
    friendsSince: new Date('2024-12-15'),
    isOnline: false,
    commonInterests: ['Crucigrama', 'Emparejamiento'],
    mutualFriends: 3,
  },
  {
    userId: 'friend-007',
    username: 'Valentina Flores',
    avatar: '/avatars/avatar-7.png',
    rank: 'halach_uinik',
    level: 26,
    xp: 54000,
    mlCoins: 15800,
    lastActive: new Date(),
    friendsSince: new Date('2024-11-05'),
    isOnline: true,
    commonInterests: ['Literatura', 'Ensayo Argumentativo', 'Reseña Crítica'],
    mutualFriends: 9,
  },
  {
    userId: 'friend-008',
    username: 'Miguel Sánchez',
    avatar: '/avatars/avatar-8.png',
    rank: 'al_mehen',
    level: 8,
    xp: 14000,
    mlCoins: 3200,
    lastActive: new Date(Date.now() - 28800000),
    friendsSince: new Date('2025-01-05'),
    isOnline: false,
    commonInterests: ['Sopa de Letras', 'Timeline'],
    mutualFriends: 2,
  },
  {
    userId: 'friend-009',
    username: 'Isabella Cruz',
    avatar: '/avatars/avatar-9.png',
    rank: 'chilan',
    level: 19,
    xp: 35000,
    mlCoins: 9500,
    lastActive: new Date(Date.now() - 43200000),
    friendsSince: new Date('2024-11-25'),
    isOnline: false,
    commonInterests: ['Detective Textual', 'Construcción de Hipótesis'],
    mutualFriends: 7,
  },
  {
    userId: 'friend-010',
    username: 'Javier Morales',
    avatar: '/avatars/avatar-10.png',
    rank: 'halach_uinik',
    level: 23,
    xp: 46000,
    mlCoins: 13200,
    lastActive: new Date(Date.now() - 86400000),
    friendsSince: new Date('2024-11-12'),
    isOnline: false,
    commonInterests: ['Quiz TikTok', 'Análisis de Memes'],
    mutualFriends: 6,
  },
  {
    userId: 'friend-011',
    username: 'Camila Rivera',
    avatar: '/avatars/avatar-11.png',
    rank: 'batab',
    level: 14,
    xp: 24000,
    mlCoins: 6100,
    lastActive: new Date(Date.now() - 172800000),
    friendsSince: new Date('2024-12-20'),
    isOnline: false,
    commonInterests: ['Crucigrama', 'Mapa Conceptual'],
    mutualFriends: 4,
  },
  {
    userId: 'friend-012',
    username: 'Pablo Díaz',
    avatar: '/avatars/avatar-12.png',
    rank: 'chilan',
    level: 21,
    xp: 40000,
    mlCoins: 11000,
    lastActive: new Date(),
    friendsSince: new Date('2024-11-18'),
    isOnline: true,
    commonInterests: ['Detective Textual', 'Predicción Narrativa', 'Puzzle Contexto'],
    mutualFriends: 8,
  },
  {
    userId: 'friend-013',
    username: 'Lucía González',
    avatar: '/avatars/avatar-13.png',
    rank: 'kukulkan',
    level: 28,
    xp: 62000,
    mlCoins: 18900,
    lastActive: new Date(Date.now() - 259200000),
    friendsSince: new Date('2024-10-15'),
    isOnline: false,
    commonInterests: ['Literatura', 'Ensayo Argumentativo', 'Email Formal'],
    mutualFriends: 10,
  },
  {
    userId: 'friend-014',
    username: 'Andrés Pérez',
    avatar: '/avatars/avatar-14.png',
    rank: 'batab',
    level: 17,
    xp: 30000,
    mlCoins: 7800,
    lastActive: new Date(Date.now() - 345600000),
    friendsSince: new Date('2024-12-05'),
    isOnline: false,
    commonInterests: ['Emparejamiento', 'Timeline'],
    mutualFriends: 5,
  },
  {
    userId: 'friend-015',
    username: 'Elena Gómez',
    avatar: '/avatars/avatar-15.png',
    rank: 'halach_uinik',
    level: 25,
    xp: 50000,
    mlCoins: 14500,
    lastActive: new Date(Date.now() - 432000000),
    friendsSince: new Date('2024-11-22'),
    isOnline: false,
    commonInterests: ['Detective Textual', 'Verificador Fake News', 'Chat Literario'],
    mutualFriends: 7,
  },
];

// Friend Requests (5 pending)
export const friendRequestsMockData: FriendRequest[] = [
  {
    id: 'request-001',
    senderId: 'user-201',
    senderName: 'Roberto Silva',
    senderAvatar: '/avatars/avatar-20.png',
    senderRank: 'chilan',
    senderLevel: 19,
    receiverId: 'current-user',
    sentAt: new Date(Date.now() - 86400000),
    status: 'pending',
    message: 'Hola! Vi que también te gusta Detective Textual. Seamos amigos!',
  },
  {
    id: 'request-002',
    senderId: 'user-202',
    senderName: 'Gabriela Vargas',
    senderAvatar: '/avatars/avatar-21.png',
    senderRank: 'batab',
    senderLevel: 14,
    receiverId: 'current-user',
    sentAt: new Date(Date.now() - 172800000),
    status: 'pending',
  },
  {
    id: 'request-003',
    senderId: 'user-203',
    senderName: 'Fernando Castro',
    senderAvatar: '/avatars/avatar-22.png',
    senderRank: 'halach_uinik',
    senderLevel: 22,
    receiverId: 'current-user',
    sentAt: new Date(Date.now() - 259200000),
    status: 'pending',
    message: 'Estamos en el mismo gremio, agreguémonos!',
  },
];

// Friend Recommendations (10 suggestions)
export const friendRecommendationsMockData: FriendRecommendation[] = [
  {
    userId: 'user-301',
    username: 'Patricia Ruiz',
    avatar: '/avatars/avatar-30.png',
    rank: 'chilan',
    level: 18,
    reason: 'Miembro de tu gremio',
    commonInterests: ['Detective Textual', 'Crucigrama'],
    mutualFriends: 5,
    score: 95,
  },
  {
    userId: 'user-302',
    username: 'Ricardo Mendoza',
    avatar: '/avatars/avatar-31.png',
    rank: 'batab',
    level: 16,
    reason: '6 amigos en común',
    commonInterests: ['Mapa Conceptual', 'Timeline'],
    mutualFriends: 6,
    score: 88,
  },
  {
    userId: 'user-303',
    username: 'Sandra Ortiz',
    avatar: '/avatars/avatar-32.png',
    rank: 'halach_uinik',
    level: 24,
    reason: 'Intereses similares',
    commonInterests: ['Literatura', 'Ensayo Argumentativo', 'Detective Textual'],
    mutualFriends: 3,
    score: 82,
  },
  {
    userId: 'user-304',
    username: 'Tomás Herrera',
    avatar: '/avatars/avatar-33.png',
    rank: 'chilan',
    level: 20,
    reason: 'Misma escuela',
    commonInterests: ['Crucigrama', 'Sopa de Letras'],
    mutualFriends: 4,
    score: 78,
  },
  {
    userId: 'user-305',
    username: 'Mónica Delgado',
    avatar: '/avatars/avatar-34.png',
    rank: 'kukulkan',
    level: 30,
    reason: 'Top performer',
    commonInterests: ['Detective Textual', 'Análisis de Memes'],
    mutualFriends: 2,
    score: 75,
  },
];

// Friend Activity Feed (20 recent activities)
export const friendActivitiesMockData: FriendActivity[] = [
  {
    id: 'activity-001',
    userId: 'friend-001',
    username: 'Ana Martínez',
    avatar: '/avatars/avatar-1.png',
    type: 'achievement',
    description: 'desbloqueó el logro "Perfeccionista"',
    timestamp: new Date(Date.now() - 1800000),
    relatedData: {
      achievementId: 'mastery-002',
      achievementName: 'Perfeccionista',
    },
    praised: true,
  },
  {
    id: 'activity-002',
    userId: 'friend-002',
    username: 'Carlos López',
    avatar: '/avatars/avatar-2.png',
    type: 'exercise',
    description: 'completó "Detective Textual: El Misterio del Manuscrito" con 95%',
    timestamp: new Date(Date.now() - 3600000),
    relatedData: {
      exerciseId: 'ex-dt-001',
      exerciseName: 'Detective Textual: El Misterio del Manuscrito',
    },
    praised: false,
  },
  {
    id: 'activity-003',
    userId: 'friend-007',
    username: 'Valentina Flores',
    avatar: '/avatars/avatar-7.png',
    type: 'rankup',
    description: 'subió a rango Halach Uinic',
    timestamp: new Date(Date.now() - 7200000),
    relatedData: {
      newRank: 'halach_uinik',
    },
    praised: true,
  },
  {
    id: 'activity-004',
    userId: 'friend-012',
    username: 'Pablo Díaz',
    avatar: '/avatars/avatar-12.png',
    type: 'achievement',
    description: 'desbloqueó el logro "Maestro de la Velocidad"',
    timestamp: new Date(Date.now() - 10800000),
    relatedData: {
      achievementId: 'mastery-004',
      achievementName: 'Maestro de la Velocidad',
    },
    praised: false,
  },
  {
    id: 'activity-005',
    userId: 'friend-005',
    username: 'Sofia Torres',
    avatar: '/avatars/avatar-5.png',
    type: 'challenge',
    description: 'completó el desafío "Maratón de Lectura Semanal"',
    timestamp: new Date(Date.now() - 14400000),
    relatedData: {
      challengeId: 'challenge-001',
    },
    praised: true,
  },
  {
    id: 'activity-006',
    userId: 'friend-003',
    username: 'María García',
    avatar: '/avatars/avatar-3.png',
    type: 'exercise',
    description: 'completó "Ensayo Argumentativo: Cambio Climático" con 100%',
    timestamp: new Date(Date.now() - 18000000),
    relatedData: {
      exerciseId: 'ex-ea-001',
      exerciseName: 'Ensayo Argumentativo: Cambio Climático',
    },
    praised: false,
  },
  {
    id: 'activity-007',
    userId: 'friend-010',
    username: 'Javier Morales',
    avatar: '/avatars/avatar-10.png',
    type: 'achievement',
    description: 'desbloqueó el logro "Corredor de Maratón"',
    timestamp: new Date(Date.now() - 21600000),
    relatedData: {
      achievementId: 'progress-010',
      achievementName: 'Corredor de Maratón',
    },
    praised: true,
  },
  {
    id: 'activity-008',
    userId: 'friend-013',
    username: 'Lucía González',
    avatar: '/avatars/avatar-13.png',
    type: 'guild',
    description: 'se unió al gremio "Maestros de la Literatura"',
    timestamp: new Date(Date.now() - 25200000),
    praised: false,
  },
];

// Helper functions
export const getOnlineFriends = (): Friend[] => {
  return friendsMockData.filter((friend) => friend.isOnline);
};

export const getPendingFriendRequests = (): FriendRequest[] => {
  return friendRequestsMockData.filter((request) => request.status === 'pending');
};

export const getTopRecommendations = (limit: number = 5): FriendRecommendation[] => {
  return friendRecommendationsMockData.slice(0, limit);
};

export const getRecentActivities = (limit: number = 10): FriendActivity[] => {
  return friendActivitiesMockData.slice(0, limit);
};

export const getFriendById = (userId: string): Friend | undefined => {
  return friendsMockData.find((friend) => friend.userId === userId);
};
