import type { PropsWithChildren } from 'react';
import React from 'react';
import type { GridTableColumnDefinition } from '@theorchard/suite-components';
import type { CellProps } from '@theorchard/suite-components/dist/esm/src/components/table/base/types';
import { HiddenListCount } from '../shared/hidden-count';

const PresentationalGroupTableColumns = () => {
    const PRESENTATIONAL_GROUP_TABLE_COLUMNS: GridTableColumnDefinition<unknown>[] =
        [
            {
                name: 'id',
                title: '#',
                maxWidth: '3.5%',
                Cell: ({ data: { id } }: PropsWithChildren<CellProps<any>>) => (
                    <div
                        className="ContractTermsConditions-gridTable-cell"
                        data-testid="id-cell"
                    >
                        {id}
                    </div>
                ),
            },
            {
                name: 'transactionType',
                title: 'Transaction Type',
                maxWidth: '28.7%',
                Cell: ({
                    data: { transactionType },
                }: PropsWithChildren<CellProps<any>>) =>
                    HiddenListCount({
                        items: transactionType,
                        maxVisibleItems: 10,
                        testId: 'transactionType-cell',
                    }),
            },
            {
                name: 'service',
                title: 'Service',
                maxWidth: '28.7%',
                Cell: ({
                    data: { service },
                }: PropsWithChildren<CellProps<any>>) =>
                    HiddenListCount({
                        items: service,
                        maxVisibleItems: 10,
                        testId: 'service-cell',
                    }),
            },
            {
                name: 'country',
                title: 'Country',
                maxWidth: '28.7%',
                Cell: ({
                    data: { country },
                }: PropsWithChildren<CellProps<any>>) =>
                    HiddenListCount({
                        items: country,
                        maxVisibleItems: 10,
                        testId: 'country-cell',
                    }),
            },
            {
                name: 'labelShare',
                title: "Label's Share",
                maxWidth: '10.6%',
                Cell: ({
                    data: { labelShare },
                }: PropsWithChildren<CellProps<any>>) => (
                    <div
                        className="ContractTermsConditions-gridTable-cell"
                        data-testid="labelshare-cell"
                    >
                        {labelShare}%
                    </div>
                ),
            },
        ];

    return PRESENTATIONAL_GROUP_TABLE_COLUMNS;
};

export default PresentationalGroupTableColumns;
