import { Router } from 'express';
import {
  create,
  createGroup,
  createVCenterConnectionRecord,
  deleteGroup,
  deleteVCenterConnectionRecord,
  destroy,
  importVCenterHosts,
  index,
  listGroups,
  listVCenterConnectionRecords,
  previewVCenterImport,
  syncGroup,
  syncGroups,
  testVCenterConnectionRecord,
  update,
  updateGroup,
  updateVCenterConnectionRecord,
  vcenterImportStatus
} from '../controllers/hostController.js';
import { requireAuth } from '../middleware/auth.js';

export const hostRoutes = Router();

hostRoutes.get('/import/vcenter/status', requireAuth, vcenterImportStatus);
hostRoutes.get('/import/vcenter/connections', requireAuth, listVCenterConnectionRecords);
hostRoutes.post('/import/vcenter/connections', requireAuth, createVCenterConnectionRecord);
hostRoutes.put('/import/vcenter/connections/:connectionId', requireAuth, updateVCenterConnectionRecord);
hostRoutes.delete('/import/vcenter/connections/:connectionId', requireAuth, deleteVCenterConnectionRecord);
hostRoutes.post('/import/vcenter/connections/:connectionId/test', requireAuth, testVCenterConnectionRecord);
hostRoutes.post('/import/vcenter/preview', requireAuth, previewVCenterImport);
hostRoutes.post('/import/vcenter', requireAuth, importVCenterHosts);
hostRoutes.get('/groups', requireAuth, listGroups);
hostRoutes.post('/groups', requireAuth, createGroup);
hostRoutes.post('/groups/sync', requireAuth, syncGroups);
hostRoutes.put('/groups/:groupId', requireAuth, updateGroup);
hostRoutes.delete('/groups/:groupId', requireAuth, deleteGroup);
hostRoutes.post('/groups/:groupId/sync', requireAuth, syncGroup);
hostRoutes.get('/', requireAuth, index);
hostRoutes.post('/', requireAuth, create);
hostRoutes.put('/:id', requireAuth, update);
hostRoutes.delete('/:id', requireAuth, destroy);
