const Page_linksService = require('../services/page_links');
const Page_linksDBApi = require('../db/api/page_links');
const { createEntityRouter } = require('../factories/router.factory');

/**
 *  @swagger
 *  components:
 *    schemas:
 *      Page_links:
 *        type: object
 *        properties:
 *          external_url:
 *            type: string
 *          trigger_selector:
 *            type: string
 */

/**
 *  @swagger
 * tags:
 *   name: Page_links
 *   description: The Page_links managing API
 */

/**
 *  @swagger
 *  /api/page_links:
 *    post:
 *      security:
 *        - bearerAuth: []
 *      tags: [Page_links]
 *      summary: Add new item
 *      requestBody:
 *        required: true
 *        content:
 *          application/json:
 *            schema:
 *              properties:
 *                data:
 *                  type: object
 *                  $ref: "#/components/schemas/Page_links"
 *      responses:
 *        200:
 *          description: The item was successfully added
 *        401:
 *          $ref: "#/components/responses/UnauthorizedError"
 *        500:
 *          description: Some server error
 *    get:
 *      security:
 *        - bearerAuth: []
 *      tags: [Page_links]
 *      summary: Get all page_links
 *      responses:
 *        200:
 *          description: Page_links list successfully received
 *        401:
 *          $ref: "#/components/responses/UnauthorizedError"
 *        500:
 *          description: Some server error
 */

/**
 *  @swagger
 *  /api/page_links/{id}:
 *    put:
 *      security:
 *        - bearerAuth: []
 *      tags: [Page_links]
 *      summary: Update the selected item
 *      parameters:
 *        - in: path
 *          name: id
 *          required: true
 *          schema:
 *            type: string
 *      requestBody:
 *        required: true
 *        content:
 *          application/json:
 *            schema:
 *              properties:
 *                id:
 *                  type: string
 *                data:
 *                  type: object
 *                  $ref: "#/components/schemas/Page_links"
 *      responses:
 *        200:
 *          description: The item was successfully updated
 *        401:
 *          $ref: "#/components/responses/UnauthorizedError"
 *        404:
 *          description: Item not found
 *        500:
 *          description: Some server error
 *    delete:
 *      security:
 *        - bearerAuth: []
 *      tags: [Page_links]
 *      summary: Delete the selected item
 *      parameters:
 *        - in: path
 *          name: id
 *          required: true
 *          schema:
 *            type: string
 *      responses:
 *        200:
 *          description: The item was successfully deleted
 *        401:
 *          $ref: "#/components/responses/UnauthorizedError"
 *        404:
 *          description: Item not found
 *        500:
 *          description: Some server error
 *    get:
 *      security:
 *        - bearerAuth: []
 *      tags: [Page_links]
 *      summary: Get selected item
 *      parameters:
 *        - in: path
 *          name: id
 *          required: true
 *          schema:
 *            type: string
 *      responses:
 *        200:
 *          description: Selected item successfully received
 *        401:
 *          $ref: "#/components/responses/UnauthorizedError"
 *        404:
 *          description: Item not found
 *        500:
 *          description: Some server error
 */

module.exports = createEntityRouter('page_links', Page_linksService, Page_linksDBApi);
