import {FC} from 'react';
import Filter from './filter';
import {ChildrenFC} from '@utils';
import {context, pageContext, useContextReducer} from './context';
import TableList from './table';
import {PageProvider} from '@components';

const RoleProvider: ChildrenFC = function({children}) {
  const state = useContextReducer();
  const {Provider} = context;

  return <Provider value={state}>{children}</Provider>;
};

const Role: FC = function() {
  return (
    <RoleProvider>
      <PageProvider context={pageContext}>
        <section className='content-main'>
          <Filter />
          <TableList />
        </section>
      </PageProvider>
    </RoleProvider>
  );
};

export default Role;
