import {
  Camera,
  CirclePlay,
  Globe,
  Layers,
  MessageCircle,
  Music2,
  Send,
  ThumbsUp,
  type LucideIcon,
} from "lucide-react";
import type { PlatformFilter, PlatformKey } from "./types";

// lucide-react v1 dropped brand marks — these are the closest neutral stand-ins.
const ICONS: Record<PlatformKey | "ALL", LucideIcon> = {
  ALL: Layers,
  INSTAGRAM: Camera,
  TIKTOK: Music2,
  YOUTUBE: CirclePlay,
  FACEBOOK: ThumbsUp,
  TELEGRAM: Send,
  TWITTER: MessageCircle,
  OTHER: Globe,
};

const TINTS: Record<PlatformKey | "ALL", string> = {
  ALL: "text-blue-600 dark:text-blue-400",
  INSTAGRAM: "text-pink-600 dark:text-pink-400",
  TIKTOK: "text-cyan-600 dark:text-cyan-400",
  YOUTUBE: "text-red-600 dark:text-red-400",
  FACEBOOK: "text-blue-600 dark:text-blue-400",
  TELEGRAM: "text-sky-600 dark:text-sky-400",
  TWITTER: "text-slate-600 dark:text-slate-300",
  OTHER: "text-violet-600 dark:text-violet-400",
};

export function platformIcon(platform: PlatformKey | PlatformFilter): LucideIcon {
  return ICONS[platform as PlatformKey | "ALL"] ?? Globe;
}

export function platformTint(platform: PlatformKey | PlatformFilter): string {
  return TINTS[platform as PlatformKey | "ALL"] ?? TINTS.OTHER;
}

export function PlatformIcon({
  platform,
  className = "size-4",
}: {
  platform: PlatformKey | PlatformFilter;
  className?: string;
}) {
  const Icon = platformIcon(platform);
  return <Icon className={className} />;
}
