


const express = require("express");
const router = express.Router();
const qcParamController = require("../../controllers/securityops/qcParamController");
const authenticate = require("../../middlewares/authenticate")


/**
 * @swagger
 * tags:
 *   name: QC Parameters
 *   description: Quality Control Parameter Management APIs
 */


router.post(
  "/create",
  authenticate,
  (req, res) => {

    /*
      #swagger.tags = ['QC Parameters']
      #swagger.summary = 'Create new QC parameter'

      #swagger.requestBody = {
        required: true,
        content: {
          "application/json": {
            schema: {
              type: "object",
              required: ["parameterName"],
              properties: {
                parameterName: {
                  type: "string",
                  example: "Moisture"
                },
                value: {
                  type: "string",
                  example: "%"
                }
              }
            }
          }
        }
      }
    */

    qcParamController.createQCParam(req, res);
  }
);


router.get(
  "/all",
  (req, res) => {

    /*
      #swagger.tags = ['QC Parameters']
      #swagger.summary = 'Get all QC parameters'
    */

    qcParamController.getQCParams(req, res);
  }
);


router.delete(
  "/delete/:id",
  (req, res) => {

    /*
      #swagger.tags = ['QC Parameters']
      #swagger.summary = 'Delete QC parameter by ID'

      #swagger.parameters['id'] = {
        in: 'path',
        required: true,
        type: 'string',
        example: '665f3f0c8f9b123456789abc'
      }
    */

    qcParamController.deleteQCParam(req, res);
  }
);


router.put(
  "/update/:id",
  (req, res) => {

    /*
      #swagger.tags = ['QC Parameters']
      #swagger.summary = 'Update QC parameter'

      #swagger.parameters['id'] = {
        in: 'path',
        required: true,
        type: 'string',
        example: '665f3f0c8f9b123456789abc'
      }

      #swagger.requestBody = {
        required: true,
        content: {
          "application/json": {
            schema: {
              type: "object",
              properties: {
                parameterName: {
                  type: "string",
                  example: "Moisture"
                },
                value: {
                  type: "string",
                  example: "%"
                }
              }
            }
          }
        }
      }
    */

    qcParamController.updateQCParam(req, res);
  }
);

module.exports = router;