import SubscriptionsOutlinedIcon from "@mui/icons-material/SubscriptionsOutlined";

import { ArticleDetail } from "../../extensions/catalog";
import { ContribComponentMap } from "../../types";

export const contrib: Record<string, ContribComponentMap> = {
  catalog: {
    "catalog:article:detail:plan": {
      title: "Subscription Plan",
      icon: SubscriptionsOutlinedIcon,
      component: async () => (await import("./contrib/ArticleSubscriptionPlan")).default,
      predicate: (article: ArticleDetail) => article.item_type == "PLAN",
      variant: "inline",
      permission: "subscription.view_subscription",
    },
  },
  dashboard: {
    "dashboard:stats:subscription:total": {
      component: async () => (await import("./contrib/SubscriptionStateCountWidget")).default,
      variant: "inline",
      permission: "subscription.view_subscription",
    },
    "dashboard:stats:subscription:events": {
      component: async () => (await import("./contrib/SubscriptionEventCountWidget")).default,
      variant: "inline",
      permission: "subscription.view_subscription",
    },
    "dashboard:stats:subscription:count": {
      component: async () => (await import("./contrib/RunningSubscriptionCountWidget")).default,
      variant: "inline",
      permission: "subscription.view_subscription",
    },
  },
} as const;
