/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-16 14:30:15
 * @LastEditors: zhoux zhouxia@supervision.ltd
 * @LastEditTime: 2023-11-16 14:56:27
 * @FilePath: \general-ai-platform-web\src\components\BatchOperation\isBatchDelete.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// import { useIntl } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { Button, Popconfirm } from 'antd';
import { FormattedMessage } from 'react-intl';

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

const IsDelete: React.FC<IsDeleteProps> = (props) => {
  const intl = useIntl();

  return (
    <Popconfirm
      key="destroy"
      placement="topLeft"
      title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })}
      description={intl.formatMessage({
        id: 'common.modal.table.delete.content',
        defaultMessage: '$$$',
      })}
      okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })}
      cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })}
      onConfirm={() => {
        props.deleteApi();
      }}
    >
      <Button type="link" size="small" danger>
        <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" />
      </Button>
    </Popconfirm>
  );
};

export default IsDelete;
