/**
 * Application Constants
 */

/**
 * Module Types
 */
export const MODULE_TYPES = {
  FUNDAMENTOS: 'FUNDAMENTOS',
  SISTEMAS: 'SISTEMAS',
  APLICACIONES: 'APLICACIONES',
} as const;

/**
 * Topic Types
 */
export const TOPIC_TYPES = {
  VECTORES: 'VECTORES',
  MATRICES: 'MATRICES',
  SISTEMAS: 'SISTEMAS',
  ESPACIOS_VECTORIALES: 'ESPACIOS_VECTORIALES',
  PROGRAMACION_LINEAL: 'PROGRAMACION_LINEAL',
} as const;

/**
 * Exercise Types
 */
export const EXERCISE_TYPES = {
  MULTIPLE_CHOICE: 'MULTIPLE_CHOICE',
  OPEN_ENDED: 'OPEN_ENDED',
  TRUE_FALSE: 'TRUE_FALSE',
  CALCULATION: 'CALCULATION',
} as const;

/**
 * Exercise Difficulties
 */
export const EXERCISE_DIFFICULTIES = {
  EASY: 'EASY',
  MEDIUM: 'MEDIUM',
  HARD: 'HARD',
} as const;

/**
 * Achievement Categories
 */
export const ACHIEVEMENT_CATEGORIES = {
  EXERCISES: 'EXERCISES',
  MODULES: 'MODULES',
  STREAKS: 'STREAKS',
  RANKING: 'RANKING',
  SPECIAL: 'SPECIAL',
} as const;

/**
 * Achievement Rarities
 */
export const ACHIEVEMENT_RARITIES = {
  COMMON: 'COMMON',
  RARE: 'RARE',
  EPIC: 'EPIC',
  LEGENDARY: 'LEGENDARY',
} as const;

/**
 * Exercise Difficulty Colors
 */
export const DIFFICULTY_COLORS = {
  EASY: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200',
  MEDIUM: 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200',
  HARD: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200',
} as const;

/**
 * Points per difficulty
 */
export const POINTS_PER_DIFFICULTY = {
  EASY: 10,
  MEDIUM: 20,
  HARD: 30,
} as const;

/**
 * Pagination
 */
export const PAGINATION = {
  DEFAULT_PAGE_SIZE: 20,
  MAX_PAGE_SIZE: 100,
} as const;

/**
 * Local Storage Keys
 */
export const STORAGE_KEYS = {
  AUTH_TOKEN: 'auth_token',
  THEME: 'theme',
  PREFERENCES: 'preferences',
} as const;

/**
 * Routes
 */
export const ROUTES = {
  HOME: '/',
  LOGIN: '/login',
  REGISTER: '/register',
  DASHBOARD: '/dashboard',
  MODULES: '/modules',
  MODULE_DETAIL: (id: string) => `/modules/${id}`,
  EXERCISES: '/exercises',
  EXERCISE_DETAIL: (id: string) => `/exercises/${id}`,
  RANKING: '/ranking',
  ACHIEVEMENTS: '/achievements',
  PROFILE: '/profile',
  SETTINGS: '/settings',
  ADMIN: '/admin',
  ADMIN_MODULES: '/admin/modules',
  ADMIN_EXERCISES: '/admin/exercises',
  ADMIN_GENERATE: '/admin/generate',
  ADMIN_STATS: '/admin/stats',
} as const;

/**
 * Achievement Definitions
 */
export const ACHIEVEMENT_DEFINITIONS = {
  // Exercises
  FIRST_STEP: {
    code: 'FIRST_STEP',
    name: 'Primer Paso',
    description: 'Completa tu primer ejercicio',
    icon: '🎯',
    rarity: 'COMMON',
    category: 'EXERCISES',
    requirementValue: 1,
  },
  IN_MOTION: {
    code: 'IN_MOTION',
    name: 'En Marcha',
    description: 'Completa 10 ejercicios',
    icon: '🚀',
    rarity: 'COMMON',
    category: 'EXERCISES',
    requirementValue: 10,
  },
  DEDICATED_MATH: {
    code: 'DEDICATED_MATH',
    name: 'Matemático Dedicado',
    description: 'Completa 100 ejercicios',
    icon: '📚',
    rarity: 'RARE',
    category: 'EXERCISES',
    requirementValue: 100,
  },
  PERFECTIONIST: {
    code: 'PERFECTIONIST',
    name: 'Perfeccionista',
    description: 'Completa 5 ejercicios sin errores',
    icon: '💎',
    rarity: 'EPIC',
    category: 'EXERCISES',
    requirementValue: 5,
  },

  // Modules
  FIRST_CONQUEST: {
    code: 'FIRST_CONQUEST',
    name: 'Primera Conquista',
    description: 'Completa tu primer módulo',
    icon: '🏆',
    rarity: 'RARE',
    category: 'MODULES',
    requirementValue: 1,
  },
  ALGEBRA_MASTER: {
    code: 'ALGEBRA_MASTER',
    name: 'Maestro del Álgebra',
    description: 'Completa todos los módulos',
    icon: '👑',
    rarity: 'LEGENDARY',
    category: 'MODULES',
    requirementValue: 3,
  },
  PERFECT_MODULE: {
    code: 'PERFECT_MODULE',
    name: 'Módulo Perfecto',
    description: 'Completa un módulo con 100%',
    icon: '⭐',
    rarity: 'EPIC',
    category: 'MODULES',
    requirementValue: 100,
  },

  // Streaks
  ON_STREAK: {
    code: 'ON_STREAK',
    name: 'En Racha',
    description: '3 días consecutivos',
    icon: '🔥',
    rarity: 'COMMON',
    category: 'STREAKS',
    requirementValue: 3,
  },
  PERFECT_WEEK: {
    code: 'PERFECT_WEEK',
    name: 'Semana Perfecta',
    description: '7 días consecutivos',
    icon: '📅',
    rarity: 'RARE',
    category: 'STREAKS',
    requirementValue: 7,
  },
  MONTHLY: {
    code: 'MONTHLY',
    name: 'Mensual',
    description: '30 días consecutivos',
    icon: '🎊',
    rarity: 'LEGENDARY',
    category: 'STREAKS',
    requirementValue: 30,
  },

  // Ranking
  TOP_10: {
    code: 'TOP_10',
    name: 'Top 10',
    description: 'Alcanza el top 10 global',
    icon: '🎖️',
    rarity: 'EPIC',
    category: 'RANKING',
    requirementValue: 10,
  },
  PODIUM: {
    code: 'PODIUM',
    name: 'Podium',
    description: 'Alcanza el top 3 global',
    icon: '🥇',
    rarity: 'LEGENDARY',
    category: 'RANKING',
    requirementValue: 3,
  },
  CHAMPION: {
    code: 'CHAMPION',
    name: 'El Campeón',
    description: 'Alcanza el #1 global',
    icon: '🏅',
    rarity: 'LEGENDARY',
    category: 'RANKING',
    requirementValue: 1,
  },

  // Special
  EARLY_BIRD: {
    code: 'EARLY_BIRD',
    name: 'Madrugador',
    description: 'Estudia antes de las 6 AM',
    icon: '🌅',
    rarity: 'RARE',
    category: 'SPECIAL',
    requirementValue: 1,
  },
  NIGHT_OWL: {
    code: 'NIGHT_OWL',
    name: 'Búho Nocturno',
    description: 'Estudia después de medianoche',
    icon: '🦉',
    rarity: 'RARE',
    category: 'SPECIAL',
    requirementValue: 1,
  },
  AUTODIDACT: {
    code: 'AUTODIDACT',
    name: 'Autodidacta',
    description: 'Completa 10 ejercicios sin pistas',
    icon: '🧠',
    rarity: 'EPIC',
    category: 'SPECIAL',
    requirementValue: 10,
  },
} as const;

/**
 * Time Constants
 */
export const TIME_CONSTANTS = {
  MINUTE: 60 * 1000,
  HOUR: 60 * 60 * 1000,
  DAY: 24 * 60 * 60 * 1000,
  WEEK: 7 * 24 * 60 * 60 * 1000,
  MONTH: 30 * 24 * 60 * 60 * 1000,
} as const;
