import {
  MdApps as Apps,
  MdMailOutline as MailOutline,
  MdOutlineGroup as GroupOutlined,
  MdOutlineAudiotrack as AudiotrackOutlined,
  MdPodcasts as Podcasts,
  MdOutlineSmartDisplay as SmartDisplayOutlined,
  MdOutlineConfirmationNumber as ConfirmationNumberOutlined,
  MdOutlineShoppingBag as ShoppingBagOutlined,
  MdOutlinePaid as PaidOutlined,
} from "react-icons/md";
import { EmailTemplateItem } from "@komi-app/creator-ui";
import config from "config";

// Category icons mapping with improved type safety
export const categoryIcons: Record<string, React.ReactNode> = {
  "Show all": <Apps size={24} />,
  "Send a newsletter": <MailOutline size={24} />,
  "Welcome subscribers": <GroupOutlined size={24} />,
  "Promote music": <AudiotrackOutlined size={24} />,
  "Promote podcast": <Podcasts size={24} />,
  "Promote video": <SmartDisplayOutlined size={24} />,
  "Sell tickets": <ConfirmationNumberOutlined size={24} />,
  "Sell merch": <ShoppingBagOutlined size={24} />,
  "Promote affiliate links": <PaidOutlined size={24} />,
};

export const getCategoryIcon = (category: string): React.ReactNode =>
  categoryIcons[category] || <Apps size={24} />;

export const blankSystemTemplate: EmailTemplateItem = {
  id: "START_FROM_SCRATCH",
  title: "Start from scratch",
  imageURL: `${config.service.assetUrl}/assets/images/blank-system-template.svg`,
};

export const allCategoriesOption = {
  id: "Show all",
  label: "Show all",
  selected: true,
  prefixIcon: getCategoryIcon("Show all"),
};
