import express from 'express';
const router = express.Router();
import * as resignationController from './resignation.controller.js';
import { authenticate } from '../../common/middleware/auth.js';

import { uploadSingle, uploadSingleIfMultipart } from '../../common/middleware/upload.js';

// Protected routes
router.post('/', authenticate as any, resignationController.createResignation);
router.get('/', authenticate as any, resignationController.getResignations);
router.get('/:id', authenticate as any, resignationController.getResignationById);
router.put('/:id/approve', authenticate as any, resignationController.approveResignation);
router.post('/:id/approve', authenticate as any, resignationController.approveResignation);

router.post('/:id/status', authenticate as any, resignationController.updateResignationStatus);
router.put('/:id/reject', authenticate as any, resignationController.rejectResignation);
router.post('/:id/reject', authenticate as any, resignationController.rejectResignation);
router.put('/:id/withdraw', authenticate as any, resignationController.withdrawResignation);
router.post('/:id/withdraw', authenticate as any, resignationController.withdrawResignation);
router.put('/:id/sendback', authenticate as any, resignationController.sendBackResignation);
router.post('/:id/sendback', authenticate as any, resignationController.sendBackResignation);
router.post('/:id/dispatch', authenticate as any, resignationController.dispatchResignationLetter);

router.put('/:id/clearance', authenticate as any, uploadSingleIfMultipart, resignationController.updateClearance);
router.post('/:id/documents', authenticate as any, uploadSingle, resignationController.uploadResignationDocument);

export default router;
