import type { PropsWithChildren } from 'react';
import React from 'react';
import type { GridTableColumnDefinition } from '@theorchard/suite-components';
import { CONTRACT_TYPE_MAP } from 'src/apollo/type-constants/contract';
import type { CellProps } from '@theorchard/suite-components/dist/esm/src/components/table/base/types';

export const RunControllerListColumns = () => {
    const RUN_CONTROLLER_LIST_COLUMNS: GridTableColumnDefinition<unknown>[] = [
        {
            name: 'contractType',
            title: 'Contract Type',
            Cell: ({
                data: { contractType },
            }: PropsWithChildren<CellProps<any>>) => (
                <>{CONTRACT_TYPE_MAP[contractType]}</>
            ),
        },
        {
            name: 'runControllerName',
            title: 'Run Controller',
            Cell: ({
                data: { runControllerName },
            }: PropsWithChildren<CellProps<any>>) => <>{runControllerName}</>,
        },
        {
            name: 'contractCount',
            title: '# of Contracts',
            Cell: ({
                data: { contractCount },
            }: PropsWithChildren<CellProps<any>>) => <>{contractCount}</>,
        },
    ];
    return RUN_CONTROLLER_LIST_COLUMNS;
};
