import React, { useState, useRef } from 'react';
import Table, { ProColumns, ActionType } from '@/components/Table';
import { fetchTableData } from '@/utils/table';
import DeleteButton from '@/components/Table/DeleteButton';

const PermissionsList = () => {
  const handleEdit = (row: any) => {};

  const handleDelete = async (name: any) => {};
  const tableRef = useRef<ActionType>();
  const columns: ProColumns<any>[] = [
    {
      title: '收款地址',
      dataIndex: 'address',
      hideInSearch: true,
      ellipsis: true,
    },
    {
      title: '收款游戏币类型',
      dataIndex: 'type',
      hideInSearch: true,
      ellipsis: true,
    },
    {
      title: '操作',
      valueType: 'option',
      width: 150,
      render: (_, row) => [
        <a
          key="edit"
          onClick={() => {
            handleEdit(row);
          }}
        >
          编辑
        </a>,
        <DeleteButton
          key="delete"
          onDelete={() => {
            handleDelete(row.name);
          }}
        />,
      ],
    },
  ];
  return (
    <div>
      <Table
        columns={columns}
        rowKey="id"
        toolBarActions={[
          {
            type: 'add',
            onConfirm: () => {},
          },
        ]}
        actionRef={tableRef}
        request={async (params) => {
          return {};
        }}
      />
    </div>
  );
};

export default PermissionsList;
