import { TEventsTableMessage, TUseCardInfoEventsTableColumns } from './types';
import {
  EnumButtonActions,
  TypeActionButtonsConfig,
} from 'components/DashboardTable/components/useActionsWithSelectedCards/types';
import { EActionType } from 'components/DashboardTable/types';
import { ExportOutlined } from '@ant-design/icons';

export const useCardInfoEventsTableColumns = (
  translations: TEventsTableMessage,
): TUseCardInfoEventsTableColumns[] => {
  const { created, message, product, sourceIp, destinationIp } = translations;
  return [
    {
      title: '#',
      dataIndex: 'events',
      key: 'events',
      checked: true,
    },
    {
      title: created,
      dataIndex: 'created',
      key: 'created',
      checked: true,
    },
    {
      title: message,
      dataIndex: 'event_src_msg',
      key: 'event_src_msg',
      checked: true,
    },
    {
      title: product,
      dataIndex: 'device_product',
      key: 'device_product',
      checked: true,
      disabled: true,
    },
    {
      title: sourceIp,
      dataIndex: 'source_ip',
      key: 'source_ip',
      checked: true,
    },
    {
      title: destinationIp,
      dataIndex: 'destination_ip',
      key: 'destination_ip',
      checked: true,
    },
  ];
};
type TypeActions = 'exports';

export const collectionButtonForIncidentsCollectiveActions =
  (collectiveHandleActions: {
    exportCSV: () => void;
  }): {
    [key in TypeActions]: TypeActionButtonsConfig;
  } => {
    const { exportCSV } = collectiveHandleActions;
    return {
      exports: {
        alwaysVisible: true,
        actionType: EActionType.SpecificAction,
        name: 'exports',
        action: exportCSV,
        translationsKey: EnumButtonActions.Exports,
        icon: ExportOutlined,
      },
    };
  };
