import type { SocialPlatform } from "@/lib/social-platforms";

const ICON_PATHS: Record<SocialPlatform, React.ReactNode> = {
  instagram: (
    <path d="M12 2c2.72 0 3.06.01 4.12.06 1.06.05 1.79.22 2.43.47.66.26 1.21.6 1.76 1.15.55.55.9 1.1 1.15 1.76.25.64.42 1.37.47 2.43.05 1.06.06 1.4.06 4.12s-.01 3.06-.06 4.12c-.05 1.06-.22 1.79-.47 2.43a4.9 4.9 0 01-1.15 1.76 4.9 4.9 0 01-1.76 1.15c-.64.25-1.37.42-2.43.47-1.06.05-1.4.06-4.12.06s-3.06-.01-4.12-.06c-1.06-.05-1.79-.22-2.43-.47a4.9 4.9 0 01-1.76-1.15 4.9 4.9 0 01-1.15-1.76c-.25-.64-.42-1.37-.47-2.43C2.01 15.06 2 14.72 2 12s.01-3.06.06-4.12c.05-1.06.22-1.79.47-2.43.26-.66.6-1.21 1.15-1.76A4.9 4.9 0 015.44 2.53c.64-.25 1.37-.42 2.43-.47C8.94 2.01 9.28 2 12 2zm0 1.8c-2.67 0-2.99.01-4.04.06-.92.04-1.42.19-1.75.32-.44.17-.75.37-1.08.7-.33.33-.53.64-.7 1.08-.13.33-.28.83-.32 1.75C4.06 9 4.05 9.32 4.05 12s.01 2.99.06 4.04c.04.92.19 1.42.32 1.75.17.44.37.75.7 1.08.33.33.64.53 1.08.7.33.13.83.28 1.75.32 1.05.05 1.37.06 4.04.06s2.99-.01 4.04-.06c.92-.04 1.42-.19 1.75-.32.44-.17.75-.37 1.08-.7.33-.33.53-.64.7-1.08.13-.33.28-.83.32-1.75.05-1.05.06-1.37.06-4.04s-.01-2.99-.06-4.04c-.04-.92-.19-1.42-.32-1.75-.17-.44-.37-.75-.7-1.08a2.9 2.9 0 00-1.08-.7c-.33-.13-.83-.28-1.75-.32C14.99 3.81 14.67 3.8 12 3.8zm0 3.05a5.15 5.15 0 110 10.3 5.15 5.15 0 010-10.3zm0 1.8a3.35 3.35 0 100 6.7 3.35 3.35 0 000-6.7zm5.35-1.99a1.2 1.2 0 11-2.4 0 1.2 1.2 0 012.4 0z" />
  ),
  facebook: (
    <path d="M13.5 21v-7.5h2.5l.4-3H13.5V8.5c0-.87.24-1.46 1.49-1.46H16.5V4.35C16.24 4.32 15.36 4.24 14.32 4.24c-2.16 0-3.64 1.32-3.64 3.74v2.56H8.17v3H10.68V21h2.82z" />
  ),
  tiktok: (
    <path d="M16.5 2h-3v13.6a2.7 2.7 0 11-2.7-2.7c.15 0 .3.01.44.03V9.86a5.7 5.7 0 105.26 5.68V8.3a7.35 7.35 0 004 1.18V6.48A4.35 4.35 0 0116.5 2z" />
  ),
  youtube: (
    <path d="M21.58 7.2s-.21-1.5-.87-2.16c-.83-.87-1.76-.87-2.19-.92C15.6 4 12 4 12 4h-.01s-3.6 0-6.52.12c-.43.05-1.36.05-2.19.92C2.63 5.7 2.42 7.2 2.42 7.2S2.2 8.95 2.2 10.71v1.63c0 1.76.22 3.51.22 3.51s.21 1.5.87 2.16c.83.87 1.92.84 2.41.94 1.75.17 7.3.22 7.3.22s3.6-.01 6.52-.13c.43-.05 1.36-.05 2.19-.92.66-.66.87-2.16.87-2.16s.22-1.75.22-3.51v-1.63c0-1.76-.22-3.51-.22-3.51zM9.99 14.6V8.83l5.34 2.89-5.34 2.88z" />
  ),
};

const LABELS: Record<SocialPlatform, string> = {
  instagram: "Instagram",
  facebook: "Facebook",
  tiktok: "TikTok",
  youtube: "YouTube",
};

export function SocialIcon({ platform, className }: { platform: SocialPlatform; className?: string }) {
  return (
    <svg
      xmlns="http://www.w3.org/2000/svg"
      viewBox="0 0 24 24"
      fill="currentColor"
      className={className}
      aria-hidden="true"
    >
      {ICON_PATHS[platform]}
    </svg>
  );
}

export function socialLabel(platform: SocialPlatform) {
  return LABELS[platform];
}
