/**
 * Bulk Action Modal Configuration
 * Dynamic bulk action confirmation modal content based on current page/table type
 * Used for: Export Selected, Update Status, and other bulk operations
 */

export interface BulkActionModalConfig {
  // Export modal config
  export: {
    title: string; // e.g., "Export Selected Keywords"
    message: (count: number) => string; // Message for export confirmation
    confirmText: string; // Button text, e.g., "Export"
    itemNamePlural: string; // e.g., "keywords"
  };
  // Update Status modal config
  updateStatus: {
    title: string; // e.g., "Update Status"
    message: (count: number) => string; // Message for status update confirmation
    confirmText: string; // Button text, e.g., "Update Status"
    itemNamePlural: string; // e.g., "keywords"
    statusOptions: Array<{ value: string; label: string }>; // Available status options
  };
}

export const bulkActionModalConfigs: Record<string, BulkActionModalConfig> = {
  '/planner/keywords': {
    export: {
      title: 'Export Selected Keywords',
      message: (count: number) => `You are about to export ${count} selected keyword${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,
      confirmText: 'Export',
      itemNamePlural: 'keywords',
    },
    updateStatus: {
      title: 'Update Status',
      message: (count: number) => `You are about to update the status of ${count} selected keyword${count !== 1 ? 's' : ''}. Select the new status below.`,
      confirmText: 'Update Status',
      itemNamePlural: 'keywords',
      statusOptions: [
        { value: 'active', label: 'Active' },
        { value: 'pending', label: 'Pending' },
        { value: 'archived', label: 'Archived' },
      ],
    },
  },
  '/planner/clusters': {
    export: {
      title: 'Export Selected Clusters',
      message: (count: number) => `You are about to export ${count} selected cluster${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,
      confirmText: 'Export',
      itemNamePlural: 'clusters',
    },
    updateStatus: {
      title: 'Update Status',
      message: (count: number) => `You are about to update the status of ${count} selected cluster${count !== 1 ? 's' : ''}. Select the new status below.`,
      confirmText: 'Update Status',
      itemNamePlural: 'clusters',
      statusOptions: [
        { value: 'active', label: 'Active' },
        { value: 'inactive', label: 'Inactive' },
      ],
    },
  },
  '/planner/ideas': {
    export: {
      title: 'Export Selected Ideas',
      message: (count: number) => `You are about to export ${count} selected idea${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,
      confirmText: 'Export',
      itemNamePlural: 'ideas',
    },
    updateStatus: {
      title: 'Update Status',
      message: (count: number) => `You are about to update the status of ${count} selected idea${count !== 1 ? 's' : ''}. Select the new status below.`,
      confirmText: 'Update Status',
      itemNamePlural: 'ideas',
      statusOptions: [
        { value: 'new', label: 'New' },
        { value: 'scheduled', label: 'Scheduled' },
        { value: 'published', label: 'Published' },
      ],
    },
  },
  '/writer/tasks': {
    export: {
      title: 'Export Selected Tasks',
      message: (count: number) => `You are about to export ${count} selected task${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,
      confirmText: 'Export',
      itemNamePlural: 'tasks',
    },
    updateStatus: {
      title: 'Update Status',
      message: (count: number) => `You are about to update the status of ${count} selected task${count !== 1 ? 's' : ''}. Select the new status below.`,
      confirmText: 'Update Status',
      itemNamePlural: 'tasks',
      statusOptions: [
        { value: 'queued', label: 'Queued' },
        { value: 'completed', label: 'Completed' },
      ],
    },
  },
  '/writer/content': {
    export: {
      title: 'Export Selected Drafts',
      message: (count: number) => `You are about to export ${count} selected draft${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,
      confirmText: 'Export',
      itemNamePlural: 'drafts',
    },
    updateStatus: {
      title: 'Update Status',
      message: (count: number) => `You are about to update the status of ${count} selected draft${count !== 1 ? 's' : ''}. Select the new status below.`,
      confirmText: 'Update Status',
      itemNamePlural: 'drafts',
      statusOptions: [
        { value: 'draft', label: 'Draft' },
        { value: 'review', label: 'Review' },
        { value: 'publish', label: 'Publish' },
      ],
    },
  },
  '/writer/published': {
    export: {
      title: 'Export Selected Published Content',
      message: (count: number) => `You are about to export ${count} selected published content item${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,
      confirmText: 'Export',
      itemNamePlural: 'published content items',
    },
    updateStatus: {
      title: 'Update Status',
      message: (count: number) => `You are about to update the status of ${count} selected published content item${count !== 1 ? 's' : ''}. Select the new status below.`,
      confirmText: 'Update Status',
      itemNamePlural: 'published content items',
      statusOptions: [
        { value: 'publish', label: 'Publish' },
        { value: 'review', label: 'Review' },
        { value: 'draft', label: 'Draft' },
      ],
    },
  },
};

/**
 * Get bulk action modal config for a given route
 */
export function getBulkActionModalConfig(route: string): BulkActionModalConfig | null {
  return bulkActionModalConfigs[route] || null;
}

