import {Card} from 'antd';
import {FC} from 'react';
import {useList} from './hooks';
import {pageContext, searchContext} from '../context';
import {ScrapContainerLogData} from '@models';
import {ColumnsType} from 'antd/es/table';
import {Table} from '@components';

const columns: ColumnsType<ScrapContainerLogData> = [
  {title: '操作人', dataIndex: 'operationName', key: 'operationName'},
  {title: '报废原因', dataIndex: 'scrapCause', key: 'scrapCause'},
  {title: '报废时间', dataIndex: 'scrapTime', key: 'scrapTime'},
  {title: '报废数量', dataIndex: 'scrapNum', key: 'scrapNum'},
];

const TableList: FC = function() {
  const [{data, count}] = useList();

  return (
    <Card className='table-wrapper'>
      <Table
        data-testid='container_scrap_table'
        columns={columns}
        data={data}
        pageContext={pageContext}
        searchContext={searchContext}
        count={count}
      />
    </Card>
  );
};

export default TableList;
