import Filter from './filter';
import {FC} from 'react';
import {context, contextState, pageContext, searchContext} from './context';
import TableList from './table';
import {MODAL_PAGE_SIZE_LIST} from '@utils';
import {PageProvider, SearchProvider, TableSearchProvider} from '@components';

type Props = {
  id: string;
};

const ChildMenu: FC<Props> = function ({id}) {
  return (
    <TableSearchProvider context={context} state={{...contextState, pId: id}}>
      <SearchProvider context={searchContext}>
        <PageProvider
          context={pageContext}
          initPageSize={MODAL_PAGE_SIZE_LIST[0]}
        >
          <section className='content-main' data-testid='child_menu'>
            <Filter />
            <TableList />
          </section>
        </PageProvider>
      </SearchProvider>
    </TableSearchProvider>
  );
};

export default ChildMenu;
