const Pwa_cachesService = require('../services/pwa_caches');
const Pwa_cachesDBApi = require('../db/api/pwa_caches');
const { createEntityRouter } = require('../factories/router.factory');

/**
 *  @swagger
 *  components:
 *    schemas:
 *      Pwa_caches:
 *        type: object
 *        properties:
 *          cache_version:
 *            type: string
 *          manifest_json:
 *            type: string
 *          asset_list_json:
 *            type: string
 *          generated_at:
 *            type: string
 *            format: date-time
 */

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

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

/**
 *  @swagger
 *  /api/pwa_caches/{id}:
 *    put:
 *      security:
 *        - bearerAuth: []
 *      tags: [Pwa_caches]
 *      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/Pwa_caches"
 *      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: [Pwa_caches]
 *      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: [Pwa_caches]
 *      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(
  'pwa_caches',
  Pwa_cachesService,
  Pwa_cachesDBApi,
);
