/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable no-tabs */
import * as React from 'react';
import {
  Table,
  Row,
  Col,
  Image,
  Tooltip,
  AutoComplete,
  Checkbox,
  Button,
  DatePicker,
  Input,
  InputNumber,
  Radio,
  Select,
  Tag,
  Upload,
  Form,
  TreeSelect,
  Tabs,
  Modal,
  Drawer,
  Dropdown,
  Menu,
  Tree,
  message,
  Progress,
  Switch,
  Breadcrumb,
  Cascader,
  Divider,
  CheckboxOptionType,
} from "antd";

import { ButtonType } from "antd/lib/button";
import { SizeType } from "antd/lib/config-provider/SizeContext";

import {
  QuestionCircleOutlined,
  UploadOutlined,
  PlusCircleOutlined,
  CloseCircleOutlined,
  PlusOutlined,
  DownOutlined,
} from "@ant-design/icons";

function FastTable(props: any) {
  const { columns } = props;
  const newColumns = columns.map((column: any) => ({
    ...column,
    dataIndex: column.key,
  }));
  const newProps = { ...props, columns: newColumns };
  return <Table {...newProps} />;
}

function FastCheckbox(props: any) {
  const { label }: { label: string } = props;
  const newProps = { ...props, name: label };
  return <Checkbox {...newProps} />;
}

const FastCheckboxGroup = Checkbox.Group;

function FastRadio(props: any) {
  const { label }: { label: string } = props;
  const newProps = { ...props, name: label };
  return <Checkbox {...newProps} />;
}

function FastSwitch(props: any) {
  const { checked, onChange } = props;
  return (
    <Switch
      {...props}
      checked={checked === 1}
      onChange={(value: boolean) => onChange(value ? 1 : 0)}
    />
  );
}

const FastRadioGroup = Radio.Group;

const FastRow = Row;
const FastCol = Col;
const FastImage = Image;
const FastTooltip = Tooltip;
const FastAutoComplete = AutoComplete;
const FastButton = Button;
const FastDatePicker = DatePicker;
const FastInput = Input;
const FastInputNumber = InputNumber;
const FastTextArea = Input.TextArea;
const FastSelect = Select;
const FastTag = Tag;
const FastTreeSelect = TreeSelect;
const FastUpload = Upload;
const FastForm = Form;
const FastTabs = Tabs;
const FastModal = Modal;
const FastDrawer = Drawer;
const FastDropdown = Dropdown;
const FastMenu = Menu;
const FastTree = Tree;
const fastMessage = message;
const FastProgress = Progress;
const FastBreadcrumb = Breadcrumb;
const FastCascader = Cascader;
const FastDivider = Divider;
// const FastEditor = Editor;

const FastIcon = {
	QuestionCircleOutlined,
	UploadOutlined,
	PlusCircleOutlined,
	CloseCircleOutlined,
	PlusOutlined,
	DownOutlined,
};

export {
  FastTable,
  FastTooltip,
  FastImage,
  FastRow,
  FastCol,
  FastIcon,
  FastAutoComplete,
  FastCheckbox,
  FastCheckboxGroup,
  FastButton,
  FastDatePicker,
  FastInput,
  FastInputNumber,
  FastTextArea,
  FastRadioGroup,
  FastRadio,
  FastSelect,
  FastTag,
  FastTreeSelect,
  FastUpload,
  FastForm,
  FastTabs,
  FastModal,
  FastDrawer,
  FastDropdown,
  FastMenu,
  FastTree,
  fastMessage,
  FastProgress,
  FastSwitch,
  FastBreadcrumb,
  FastCascader,
  FastDivider,
  // FastEditor,
};

export type {
	CheckboxOptionType,
	ButtonType,
	SizeType,
};
