import { Outlined } from 'client/Components/Spinner';
import { formatMoney } from 'core/tools/format';
import { InsTableColumn } from '../../../lib/config/table';

const columns: InsTableColumn[] = [
  {
    title: 'Страховая компания',
    dataIndex: 'name',
  },
  {
    title: 'Сумма',
    dataIndex: 'kaskoSum',
    //@ts-ignore
    sorter: (a, b) => a.kaskoSum || 0 - b.kaskoSum || 0,
    sortDirections: ['descend', 'ascend'],
    render: value => formatMoney(value, 'RUB'),
  },
  {
    title: 'Франшиза',
    dataIndex: 'totalFranchise',
    render: value => formatMoney(value, 'RUB'),
  },
  {
    title: undefined,
    dataIndex: 'isFetching',
    render: isFetching => (isFetching ? Outlined : null),
  },
];

export default columns;
