text: const express = require('express');
  const auth = require('../../middlewares/auth');
  const validate = require('../../middlewares/validate');
  const sectionValidation = require('../../validations/section.validation');
  const sectionController = require('../../controllers/section.controller');
  
  const router = express.Router();
  
  router
    .route('/')
    .post(auth('section.create'), validate(sectionValidation.createSection), sectionController.createSection)
    .get(auth('section.gets'), validate(sectionValidation.getCategories), sectionController.getSections);
  
  router
    .route('/:sectionId')
    .get(auth('section.get'), validate(sectionValidation.getSection), sectionController.getSection)
    .patch(auth('section.update'), validate(sectionValidation.updateSection), sectionController.updateSection)
    .delete(auth('section.delete'), validate(sectionValidation.deleteSection), sectionController.deleteSection);
  
  module.exports = router;
  
  /**
   * @swagger
   * tags:
   *   name: Sections
   *   description: Section management and retrieval
   */
  
  /**
   * @swagger
   * /sections:
   *   post:
   *     summary: Create a section
   *     description: Only instructor can create owner section.
   *     tags: [Sections]
   *     security:
   *       - bearerAuth: []
   *     requestBody:
   *       required: true
   *       content:
   *         application/json:
   *           schema:
   *             type: object
   *             required:
   *               - name
   *             properties:
   *               name:
   *                 type: string
   *               totalTime:
   *                 type: number
   *               order:
   *                 type: number
   *             example:
   *               name: fake name
   *               course: 2da059832c99349037d894ed
   *     responses:
   *       "201":
   *         description: Created
   *         content:
   *           application/json:
   *             schema:
   *                $ref: '#/components/schemas/Section'
   *       "400":
   *         $ref: '#/components/responses/DuplicateEmail'
   *       "401":
   *         $ref: '#/components/responses/Unauthorized'
   *       "403":
   *         $ref: '#/components/responses/Forbidden'
   *
   *   get:
   *     summary: Get all sections
   *     description: All user can retrieve all sections.
   *     tags: [Sections]
   *     security:
   *       - bearerAuth: []
   *     parameters:
   *       - in: query
   *         name: name
   *         schema:
   *           type: string
   *         description: Section name
   *       - in: query
   *         name: sortBy
   *         schema:
   *           type: string
   *         description: sort by query in the form of field:desc/asc (ex. name:asc)
   *       - in: query
   *         name: limit
   *         schema:
   *           type: integer
   *           minimum: 1
   *         default: 10
   *         description: Maximum number of sections
   *       - in: query
   *         name: page
   *         schema:
   *           type: integer
   *           minimum: 1
   *           default: 1
   *         description: Page number
   *     responses:
   *       "200":
   *         description: OK
   *         content:
   *           application/json:
   *             schema:
   *               type: object
   *               properties:
   *                 results:
   *                   type: array
   *                   items:
   *                     $ref: '#/components/schemas/Section'
   *                 page:
   *                   type: integer
   *                   example: 1
   *                 limit:
   *                   type: integer
   *                   example: 10
   *                 totalPages:
   *                   type: integer
   *                   example: 1
   *                 totalResults:
   *                   type: integer
   *                   example: 1
   *       "401":
   *         $ref: '#/components/responses/Unauthorized'
   *       "403":
   *         $ref: '#/components/responses/Forbidden'
   */
  
  /**
   * @swagger
   * /sections/{id}:
   *   get:
   *     summary: Get a section
   *     description: all users can fetch other sections.
   *     tags: [Sections]
   *     security:
   *       - bearerAuth: []
   *     parameters:
   *       - in: path
   *         name: id
   *         required: true
   *         schema:
   *           type: string
   *         description: Section id
   *     responses:
   *       "200":
   *         description: OK
   *         content:
   *           application/json:
   *             schema:
   *                $ref: '#/components/schemas/Section'
   *       "401":
   *         $ref: '#/components/responses/Unauthorized'
   *       "403":
   *         $ref: '#/components/responses/Forbidden'
   *       "404":
   *         $ref: '#/components/responses/NotFound'
   *
   *   patch:
   *     summary: Update a section
   *     description: Only instructor can update owner sections.
   *     tags: [Sections]
   *     security:
   *       - bearerAuth: []
   *     parameters:
   *       - in: path
   *         name: id
   *         required: true
   *         schema:
   *           type: string
   *         description: Section id
   *     requestBody:
   *       required: true
   *       content:
   *         application/json:
   *           schema:
   *             type: object
   *             properties:
   *               name:
   *                 type: string
   *               totalTime:
   *                 type: number
   *               order:
   *                 type: number
   *             example:
   *               name: fake name
   *               course: 2da059832c99349037d894ed
   *     responses:
   *       "200":
   *         description: OK
   *         content:
   *           application/json:
   *             schema:
   *                $ref: '#/components/schemas/Section'
   *       "400":
   *         $ref: '#/components/responses/DuplicateEmail'
   *       "401":
   *         $ref: '#/components/responses/Unauthorized'
   *       "403":
   *         $ref: '#/components/responses/Forbidden'
   *       "404":
   *         $ref: '#/components/responses/NotFound'
   *
   *   delete:
   *     summary: Delete a section
   *     description: Only admins can delete other sections.
   *     tags: [Sections]
   *     security:
   *       - bearerAuth: []
   *     parameters:
   *       - in: path
   *         name: id
   *         required: true
   *         schema:
   *           type: string
   *         description: Section id
   *       - in: query
   *         name: course
   *         required: true
   *         schema:
   *           type: string
   *         description: Course id
   *     responses:
   *       "200":
   *         description: No content
   *       "401":
   *         $ref: '#/components/responses/Unauthorized'
   *       "403":
   *         $ref: '#/components/responses/Forbidden'
   *       "404":
   *         $ref: '#/components/responses/NotFound'
   */
  