import { getUserDoneResponsesAction } from '@kit/doctor/actions/table-data-fetching-actions';
import { PageBody, PageHeader } from '@kit/ui/page';

import {
  DoctorPageViewAction,
  createDoctorPageViewLog,
} from '~/lib/services/audit/doctorPageView.service';

import { DoctorGuard } from '../_components/doctor-guard';
import ResultsTableWrapper from '../_components/results-table-wrapper';

async function CompletedJobsPage() {
  await createDoctorPageViewLog({
    action: DoctorPageViewAction.VIEW_DONE_JOBS,
  });

  return (
    <>
      <PageHeader />
      <PageBody>
        <ResultsTableWrapper
          titleKey="doctor:completedReviews"
          action={getUserDoneResponsesAction}
          queryKey="doctor-done-jobs"
        />
      </PageBody>
    </>
  );
}

export default DoctorGuard(CompletedJobsPage);
