import { WEBHOOK_EVENT_OPTIONS, WEBHOOK_EVENT_VALUES } from "@/lib/developers/catalog";
import type { IntegrationProvider, WebhookEventType } from "@/types";

export const INTEGRATION_PROVIDER_OPTIONS: Array<{
  value: IntegrationProvider;
  label: string;
  description: string;
}> = [
  {
    value: "gmail",
    label: "Gmail",
    description: "Review recent emails and capture them into tasks or notes.",
  },
  {
    value: "google_drive",
    label: "Google Drive",
    description: "Browse recent Drive files and capture them into your workspace.",
  },
  {
    value: "telegram",
    label: "Telegram",
    description: "Push workspace updates into a Telegram chat with a bot token and chat id.",
  },
  {
    value: "google_sheets",
    label: "Google Sheets",
    description: "Send workspace events into a Google Sheet through an Apps Script webhook.",
  },
  {
    value: "notion",
    label: "Notion",
    description: "Write workspace updates as child pages under a Notion parent page.",
  },
  {
    value: "github",
    label: "GitHub",
    description: "Connect a repo with a personal token and turn tasks into GitHub issues.",
  },
  {
    value: "google_calendar",
    label: "Google Calendar",
    description: "Sync Mindavio events into a connected Google Calendar.",
  },
  {
    value: "slack",
    label: "Slack",
    description: "Post workspace events into a Slack channel through an incoming webhook.",
  },
];

export const SLACK_EVENT_OPTIONS = WEBHOOK_EVENT_OPTIONS;
export const SLACK_EVENT_VALUES = WEBHOOK_EVENT_VALUES;

const EVENT_LABELS = new Map<WebhookEventType, string>(
  WEBHOOK_EVENT_OPTIONS.map((option) => [option.value, option.label])
);

export function getIntegrationEventLabel(eventType: WebhookEventType) {
  return EVENT_LABELS.get(eventType) || eventType;
}
