/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-16 14:30:15
 * @LastEditors: donghao donghao@supervision.ltd
 * @LastEditTime: 2024-07-02 15:41:40
 * @FilePath: \general-ai-platform-web\src\components\BatchOperation\isBatchDelete.tsx
 * @Description: 集中删除
 */
import { ExclamationCircleOutlined } from '@ant-design/icons';
// import { useIntl } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Button, Modal } from 'antd';

type IsBatchDeleteProps = {
  // eslint-disable-next-line @typescript-eslint/ban-types
  deleteApi: Function;
};

const IsBatchDelete: React.FC<IsBatchDeleteProps> = (props) => {
  const intl = useIntl();

  return (
    <Button
      danger
      onClick={async () => {
        Modal.confirm({
          icon: <ExclamationCircleOutlined />,
          title: intl.formatMessage({
            id: 'common.modal.table.delete.title',
            defaultMessage: '$$$',
          }),
          content: intl.formatMessage({
            id: 'common.modal.table.delete.content',
            defaultMessage: '$$$',
          }),
          okText: intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' }),
          cancelText: intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' }),
          onOk() {
            props.deleteApi();
          },
          onCancel() {
            console.log('Cancel');
          },
        });
      }}
    >
      <FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="Batch deletion" />
    </Button>
  );
};

export default IsBatchDelete;
