import { Router } from 'express';
import * as pipelineController from '../controllers/pipelineController';
import { authenticate } from '../middleware/auth';

const router = Router();

// All pipeline routes require authentication
router.use(authenticate);

// Pipeline CRUD
router.get('/', pipelineController.getPipelines);
router.get('/:id', pipelineController.getPipeline);
router.post('/', pipelineController.createPipeline);
router.put('/:id', pipelineController.updatePipeline);
router.delete('/:id', pipelineController.deletePipeline);

// Stage management
router.post('/:pipelineId/stages', pipelineController.createStage);
router.put('/stages/:id', pipelineController.updateStage);
router.delete('/stages/:id', pipelineController.deleteStage);

// Kanban board
router.get('/:pipelineId/kanban', pipelineController.getKanbanBoard);
router.put('/leads/:leadId/move', pipelineController.moveLeadToStage);

export default router;
