import { Router } from 'express';
import {
  catalog,
  create,
  destroy,
  index,
  intuneCreate,
  intuneDestroy,
  intuneGraphAssign,
  intuneGraphAudit,
  intuneGraphDrift,
  intuneGraphLink,
  intuneGraphPublish,
  intuneGraphRelationships,
  intuneBuild,
  intuneBuilderStatus,
  intuneGraphReconcile,
  intuneGraphStatus,
  intuneGraphSync,
  intuneGraphUploadContent,
  intuneIndex,
  intuneNewVersion,
  intunePromote,
  intuneShow,
  intuneUpdate,
  migrationApply,
  migrationPlan,
  render,
  rules,
  show,
  update,
  validate
} from '../controllers/psadtController.js';
import { requireAuth } from '../middleware/auth.js';

export const psadtRoutes = Router();

// PSADT Workbench APIs expose reference support plus persistent deployment profiles.
psadtRoutes.get('/catalog', requireAuth, catalog);
psadtRoutes.get('/validation-rules', requireAuth, rules);
psadtRoutes.post('/validate', requireAuth, validate);
psadtRoutes.post('/migration/plan', requireAuth, migrationPlan);
psadtRoutes.post('/migration/apply', requireAuth, migrationApply);
psadtRoutes.get('/intune/deployments', requireAuth, intuneIndex);
psadtRoutes.post('/intune/deployments', requireAuth, intuneCreate);
psadtRoutes.get('/intune/deployments/:id', requireAuth, intuneShow);
psadtRoutes.put('/intune/deployments/:id', requireAuth, intuneUpdate);
psadtRoutes.delete('/intune/deployments/:id', requireAuth, intuneDestroy);
psadtRoutes.get('/intune/deployments/:id/graph/status', requireAuth, intuneGraphStatus);
psadtRoutes.post('/intune/deployments/:id/graph/link', requireAuth, intuneGraphLink);
psadtRoutes.post('/intune/deployments/:id/graph/sync', requireAuth, intuneGraphSync);
psadtRoutes.post('/intune/deployments/:id/graph/publish', requireAuth, intuneGraphPublish);
psadtRoutes.post('/intune/deployments/:id/graph/assign', requireAuth, intuneGraphAssign);
psadtRoutes.post('/intune/deployments/:id/graph/relationships', requireAuth, intuneGraphRelationships);
psadtRoutes.post('/intune/deployments/:id/graph/upload-content', requireAuth, intuneGraphUploadContent);
psadtRoutes.post('/intune/deployments/:id/graph/drift', requireAuth, intuneGraphDrift);
psadtRoutes.post('/intune/deployments/:id/graph/reconcile', requireAuth, intuneGraphReconcile);
psadtRoutes.get('/intune/builder/status', requireAuth, intuneBuilderStatus);
psadtRoutes.post('/intune/deployments/:id/build', requireAuth, intuneBuild);
psadtRoutes.post('/intune/deployments/:id/new-version', requireAuth, intuneNewVersion);
psadtRoutes.post('/intune/deployments/:id/promote', requireAuth, intunePromote);
psadtRoutes.get('/intune/deployments/:id/graph/audit', requireAuth, intuneGraphAudit);
psadtRoutes.get('/profiles', requireAuth, index);
psadtRoutes.post('/profiles', requireAuth, create);
psadtRoutes.get('/profiles/:id', requireAuth, show);
psadtRoutes.put('/profiles/:id', requireAuth, update);
psadtRoutes.delete('/profiles/:id', requireAuth, destroy);
psadtRoutes.get('/profiles/:id/render', requireAuth, render);
