import {
  callDetailsApi,
  employeeWorkingTimeApi,
  runningApplicationsApi,
  systemLoginDetailsApi,
  systemSleepDetailsApi,
  graphApi,
  dashboardTableApi,
  UsersApi,
  activityPageDropdown,
  activityPage,
  activityChartsReport,
  CallAcivityReports,
  sessionReports,
  logActivityReport,
  getActivityReportFilterDrodowns,
  getAllUsers,
  createModifyRoles,
  UserActiveInactive,
  deleteUser,
  addUser,
  updateUser,
  userRolesPermissions,
  getUserSummaryDetails,
  getBrowsingDetails,
  top10bottom10,
  userLocation,
  getRunningApplicationDetails,
  getUserPermissions,
  getScreenshots,
  getAllMenu,
  getRoleDetails,
  getManageRole,
  updateRolePermission,
  getAuditLogs,
  deleteRole,
  smartSearch,
  getGlobalConfig,
  updateGlobalConfig,
  setGlobalConfigFieldStatus,
} from './apiEndPoints.js';

describe('API Endpoints', () => {
  test('callDetailsApi is defined and starts with /api/', () => {
    expect(callDetailsApi).toBeDefined();
    expect(typeof callDetailsApi).toBe('string');
    expect(callDetailsApi).toMatch(/^\/api\//);
    expect(callDetailsApi).toBe('/api/GetCallDetails');
  });

  test('employeeWorkingTimeApi is defined and starts with /api/', () => {
    expect(employeeWorkingTimeApi).toBeDefined();
    expect(typeof employeeWorkingTimeApi).toBe('string');
    expect(employeeWorkingTimeApi).toMatch(/^\/api\//);
    expect(employeeWorkingTimeApi).toBe('/api/GetEmployeeWorkingTime');
  });

  test('runningApplicationsApi is defined and starts with /api/', () => {
    expect(runningApplicationsApi).toBeDefined();
    expect(typeof runningApplicationsApi).toBe('string');
    expect(runningApplicationsApi).toMatch(/^\/api\//);
  });

  test('systemLoginDetailsApi is defined and starts with /api/', () => {
    expect(systemLoginDetailsApi).toBeDefined();
    expect(typeof systemLoginDetailsApi).toBe('string');
    expect(systemLoginDetailsApi).toMatch(/^\/api\//);
  });

  test('systemSleepDetailsApi is defined and starts with /api/', () => {
    expect(systemSleepDetailsApi).toBeDefined();
    expect(typeof systemSleepDetailsApi).toBe('string');
    expect(systemSleepDetailsApi).toMatch(/^\/api\//);
  });

  test('graphApi is defined and starts with /api/', () => {
    expect(graphApi).toBeDefined();
    expect(typeof graphApi).toBe('string');
    expect(graphApi).toMatch(/^\/api\//);
  });

  test('dashboardTableApi is defined and starts with /api/', () => {
    expect(dashboardTableApi).toBeDefined();
    expect(typeof dashboardTableApi).toBe('string');
    expect(dashboardTableApi).toMatch(/^\/api\//);
  });

  test('UsersApi is defined and starts with /api/', () => {
    expect(UsersApi).toBeDefined();
    expect(typeof UsersApi).toBe('string');
    expect(UsersApi).toMatch(/^\/api\//);
  });

  test('activityPageDropdown is defined and starts with /api/', () => {
    expect(activityPageDropdown).toBeDefined();
    expect(typeof activityPageDropdown).toBe('string');
    expect(activityPageDropdown).toMatch(/^\/api\//);
  });

  test('activityPage is defined and starts with /api/', () => {
    expect(activityPage).toBeDefined();
    expect(typeof activityPage).toBe('string');
    expect(activityPage).toMatch(/^\/api\//);
  });

  test('activityChartsReport is defined and starts with /api/', () => {
    expect(activityChartsReport).toBeDefined();
    expect(typeof activityChartsReport).toBe('string');
    expect(activityChartsReport).toMatch(/^\/api\//);
  });

  test('CallAcivityReports is defined and starts with /api/', () => {
    expect(CallAcivityReports).toBeDefined();
    expect(typeof CallAcivityReports).toBe('string');
    expect(CallAcivityReports).toMatch(/^\/api\//);
  });

  test('sessionReports is defined and starts with /api/', () => {
    expect(sessionReports).toBeDefined();
    expect(typeof sessionReports).toBe('string');
    expect(sessionReports).toMatch(/^\/api\//);
  });

  test('logActivityReport is defined and starts with /api/', () => {
    expect(logActivityReport).toBeDefined();
    expect(typeof logActivityReport).toBe('string');
    expect(logActivityReport).toMatch(/^\/api\//);
  });

  test('getActivityReportFilterDrodowns is defined and starts with /api/', () => {
    expect(getActivityReportFilterDrodowns).toBeDefined();
    expect(typeof getActivityReportFilterDrodowns).toBe('string');
    expect(getActivityReportFilterDrodowns).toMatch(/^\/api\//);
  });

  test('getAllUsers is defined and starts with /api/', () => {
    expect(getAllUsers).toBeDefined();
    expect(typeof getAllUsers).toBe('string');
    expect(getAllUsers).toMatch(/^\/api\//);
  });

  test('createModifyRoles is defined and starts with /api/', () => {
    expect(createModifyRoles).toBeDefined();
    expect(typeof createModifyRoles).toBe('string');
    expect(createModifyRoles).toMatch(/^\/api\//);
  });

  test('UserActiveInactive is defined and starts with /api/', () => {
    expect(UserActiveInactive).toBeDefined();
    expect(typeof UserActiveInactive).toBe('string');
    expect(UserActiveInactive).toMatch(/^\/api\//);
  });

  test('deleteUser is defined and starts with /api/', () => {
    expect(deleteUser).toBeDefined();
    expect(typeof deleteUser).toBe('string');
    expect(deleteUser).toMatch(/^\/api\//);
  });

  test('addUser is defined and starts with /api/', () => {
    expect(addUser).toBeDefined();
    expect(typeof addUser).toBe('string');
    expect(addUser).toMatch(/^\/api\//);
  });

  test('updateUser is defined and starts with /api/', () => {
    expect(updateUser).toBeDefined();
    expect(typeof updateUser).toBe('string');
    expect(updateUser).toMatch(/^\/api\//);
  });

  test('userRolesPermissions is defined and starts with /api/', () => {
    expect(userRolesPermissions).toBeDefined();
    expect(typeof userRolesPermissions).toBe('string');
    expect(userRolesPermissions).toMatch(/^\/api\//);
  });

  test('getUserSummaryDetails is defined and starts with /api/', () => {
    expect(getUserSummaryDetails).toBeDefined();
    expect(typeof getUserSummaryDetails).toBe('string');
    expect(getUserSummaryDetails).toMatch(/^\/api\//);
  });

  test('getBrowsingDetails is defined and starts with /api/', () => {
    expect(getBrowsingDetails).toBeDefined();
    expect(typeof getBrowsingDetails).toBe('string');
    expect(getBrowsingDetails).toMatch(/^\/api\//);
  });

  test('top10bottom10 is defined and starts with /api/', () => {
    expect(top10bottom10).toBeDefined();
    expect(typeof top10bottom10).toBe('string');
    expect(top10bottom10).toMatch(/^\/api\//);
  });

  test('userLocation is defined and starts with /api/', () => {
    expect(userLocation).toBeDefined();
    expect(typeof userLocation).toBe('string');
    expect(userLocation).toMatch(/^\/api\//);
  });

  test('getRunningApplicationDetails is defined and starts with /api/', () => {
    expect(getRunningApplicationDetails).toBeDefined();
    expect(typeof getRunningApplicationDetails).toBe('string');
    expect(getRunningApplicationDetails).toMatch(/^\/api\//);
  });

  test('getUserPermissions is defined and starts with /api/', () => {
    expect(getUserPermissions).toBeDefined();
    expect(typeof getUserPermissions).toBe('string');
    expect(getUserPermissions).toMatch(/^\/api\//);
  });

  test('getScreenshots is defined and starts with /api/', () => {
    expect(getScreenshots).toBeDefined();
    expect(typeof getScreenshots).toBe('string');
    expect(getScreenshots).toMatch(/^\/api\//);
  });

  test('getAllMenu is defined and starts with /api/', () => {
    expect(getAllMenu).toBeDefined();
    expect(typeof getAllMenu).toBe('string');
    expect(getAllMenu).toMatch(/^\/api\//);
  });

  test('getRoleDetails is defined and starts with /api/', () => {
    expect(getRoleDetails).toBeDefined();
    expect(typeof getRoleDetails).toBe('string');
    expect(getRoleDetails).toMatch(/^\/api\//);
  });

  test('getManageRole is defined and starts with /api/', () => {
    expect(getManageRole).toBeDefined();
    expect(typeof getManageRole).toBe('string');
    expect(getManageRole).toMatch(/^\/api\//);
  });

  test('updateRolePermission is defined and starts with /api/', () => {
    expect(updateRolePermission).toBeDefined();
    expect(typeof updateRolePermission).toBe('string');
    expect(updateRolePermission).toMatch(/^\/api\//);
  });

  test('getAuditLogs is defined and starts with /api/', () => {
    expect(getAuditLogs).toBeDefined();
    expect(typeof getAuditLogs).toBe('string');
    expect(getAuditLogs).toMatch(/^\/api\//);
  });

  test('deleteRole is defined and starts with /api/', () => {
    expect(deleteRole).toBeDefined();
    expect(typeof deleteRole).toBe('string');
    expect(deleteRole).toMatch(/^\/api\//);
  });

  test('smartSearch is defined and starts with /api/', () => {
    expect(smartSearch).toBeDefined();
    expect(typeof smartSearch).toBe('string');
    expect(smartSearch).toMatch(/^\/api\//);
  });

  test('getGlobalConfig is defined and starts with /api/', () => {
    expect(getGlobalConfig).toBeDefined();
    expect(typeof getGlobalConfig).toBe('string');
    expect(getGlobalConfig).toMatch(/^\/api\//);
  });

  test('updateGlobalConfig is defined and starts with /api/', () => {
    expect(updateGlobalConfig).toBeDefined();
    expect(typeof updateGlobalConfig).toBe('string');
    expect(updateGlobalConfig).toMatch(/^\/api\//);
  });

  test('setGlobalConfigFieldStatus is defined and starts with /api/', () => {
    expect(setGlobalConfigFieldStatus).toBeDefined();
    expect(typeof setGlobalConfigFieldStatus).toBe('string');
    expect(setGlobalConfigFieldStatus).toMatch(/^\/api\//);
  });

  test('all exported endpoints are strings', () => {
    const endpoints = [
      callDetailsApi,
      employeeWorkingTimeApi,
      runningApplicationsApi,
      systemLoginDetailsApi,
      systemSleepDetailsApi,
      graphApi,
      dashboardTableApi,
      UsersApi,
      activityPageDropdown,
      activityPage,
      activityChartsReport,
      CallAcivityReports,
      sessionReports,
      logActivityReport,
      getActivityReportFilterDrodowns,
      getAllUsers,
      createModifyRoles,
      UserActiveInactive,
      deleteUser,
      addUser,
      updateUser,
      userRolesPermissions,
      getUserSummaryDetails,
      getBrowsingDetails,
      top10bottom10,
      userLocation,
      getRunningApplicationDetails,
      getUserPermissions,
      getScreenshots,
      getAllMenu,
      getRoleDetails,
      getManageRole,
      updateRolePermission,
      getAuditLogs,
      deleteRole,
      smartSearch,
      getGlobalConfig,
      updateGlobalConfig,
      setGlobalConfigFieldStatus,
    ];

    endpoints.forEach((endpoint) => {
      expect(typeof endpoint).toBe('string');
      expect(endpoint.length).toBeGreaterThan(0);
    });
  });

  test('all endpoints start with /api/', () => {
    const endpoints = [
      callDetailsApi,
      employeeWorkingTimeApi,
      runningApplicationsApi,
      systemLoginDetailsApi,
      systemSleepDetailsApi,
      graphApi,
      dashboardTableApi,
      UsersApi,
      activityPageDropdown,
      activityPage,
      activityChartsReport,
      CallAcivityReports,
      sessionReports,
      logActivityReport,
      getActivityReportFilterDrodowns,
      getAllUsers,
      createModifyRoles,
      UserActiveInactive,
      deleteUser,
      addUser,
      updateUser,
      userRolesPermissions,
      getUserSummaryDetails,
      getBrowsingDetails,
      top10bottom10,
      userLocation,
      getRunningApplicationDetails,
      getUserPermissions,
      getScreenshots,
      getAllMenu,
      getRoleDetails,
      getManageRole,
      updateRolePermission,
      getAuditLogs,
      deleteRole,
      smartSearch,
      getGlobalConfig,
      updateGlobalConfig,
      setGlobalConfigFieldStatus,
    ];

    endpoints.forEach((endpoint) => {
      expect(endpoint).toMatch(/^\/api\//);
    });
  });
});
