import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

export function formatTimestamp(date: Date): string {
  const hours = date.getHours().toString().padStart(2, '0');
  const minutes = date.getMinutes().toString().padStart(2, '0');
  const seconds = date.getSeconds().toString().padStart(2, '0');
  const ms = date.getMilliseconds().toString().padStart(3, '0');
  return `${hours}:${minutes}:${seconds}.${ms}`;
}

export function getFileIcon(fileName: string): string {
  if (fileName.endsWith('.lua')) return '🎮';
  if (fileName.endsWith('.js') || fileName.endsWith('.jsx')) return '🌐';
  if (fileName.endsWith('.ts') || fileName.endsWith('.tsx')) return '📘';
  if (fileName.endsWith('.html')) return '📄';
  if (fileName.endsWith('.css')) return '🎨';
  if (fileName.endsWith('.json')) return '📋';
  if (fileName.endsWith('.md')) return '📝';
  return '📄';
}

export function getPlatformIcon(platform: string): string {
  switch (platform) {
    case 'roblox': return '🎮';
    case 'web': return '🌐';
    case 'mobile': return '📱';
    case 'desktop': return '🖥️';
    case 'shared': return '🔗';
    default: return '📄';
  }
}

export function getPlatformColor(platform: string): string {
  switch (platform) {
    case 'roblox': return 'text-red-400';
    case 'web': return 'text-blue-400';
    case 'mobile': return 'text-green-400';
    case 'desktop': return 'text-purple-400';
    case 'system': return 'text-gray-400';
    default: return 'text-gray-400';
  }
}
