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

type Props = {id: string};

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

export default ContainerScrap;
