import express from 'express';
import {
  createCustomer,
  getAllCustomers,
  getCustomerById,
  getAssignedCustomers,
  assignCustomer,
  updateCustomerStatus
} from '../controllers/customerController.js';
import { authenticateToken, isAdmin } from '../middleware/auth.js';
import { upload } from '../middleware/upload.js';

const router = express.Router();

router.post('/',          upload.fields([{ name: 'resume', maxCount: 1 }]), createCustomer);
router.get('/',           authenticateToken, getAllCustomers);
router.get('/assigned',   authenticateToken, getAssignedCustomers);
router.get('/:id',        authenticateToken, getCustomerById);
router.post('/assign',    authenticateToken, isAdmin, assignCustomer);
router.put('/:id/status', authenticateToken, updateCustomerStatus);

export default router;