import { SocialNetworkWhatsappsController } from "../../controllers/social-network/social-network-whatsapp.controller";
import { AuthMiddleware } from "../../middleware/auth.middleware";
import { upload } from "../../utils/handlers/store.handle";
import { SocialNetworkWhatsappsValidator } from "../../validators/social-network/social-network-whatsapp.validator";
import { AbstractRoute } from "../abstract.route";

const express = require("express");
const router = express.Router();
const controller = new SocialNetworkWhatsappsController();

class SocialNetworkWhatsappsRoute extends AbstractRoute {
  constructor(_controller, _router) {
    super(_controller, _router, new SocialNetworkWhatsappsValidator(), []);
    this.customMethods = ["getItem", "getItems", "createItem", "connect", "sendMessages", "sendPhotos", "sendVideos", "sendAudios", "disconnect", "session"];
  }
  /**
   * Connect social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/connect:
   *    post:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Connect to social Network Whatsapps"
   *      description: "Connect to social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "POSTconnectSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkWhatsappsConnectSchema"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  connect() {
    this.router.post(
      "/connect",
      AuthMiddleware,
      this.validator.connect(),
      this.controller.connect.bind(this.controller)
    );
  }
  /**
   * Disconnect social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/disconnect:
   *    post:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Disconnect to social Network Whatsapps"
   *      description: "Disconnect to social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "POSTdisconnectSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  disconnect() {
    this.router.post(
      "/disconnect",
      AuthMiddleware,
      this.validator.connect(),
      this.controller.disconnect.bind(this.controller)
    );
  }
  /**
   * Send message social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/send-message:
   *    post:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Send message to social Network Whatsapps"
   *      description: "Send message to social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "POSTsendMessageSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkWhatsappsSendMessageItem"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  sendMessages() {
    this.router.post(
      "/send-message",
      AuthMiddleware,
      this.validator.sendMessages(),
      this.controller.sendMessages.bind(this.controller)
    );
  }
  /**
   * Send photo social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/send-photo:
   *    post:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Send photo to social Network Whatsapps"
   *      description: "Send photo to social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "POSTsendPhotoSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkWhatsappsSendPhotoItem"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  sendPhotos() {
    this.router.post(
      "/send-photo",
      AuthMiddleware,
      this.validator.sendPhotos(),
      this.controller.sendPhotos.bind(this.controller)
    );
  }
  /**
   * Send video social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/send-video:
   *    post:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Send video to social Network Whatsapps"
   *      description: "Send video to social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "POSTsendVideoSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkWhatsappsSendVideoItem"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  sendVideos() {
    this.router.post(
      "/send-video",
      AuthMiddleware,
      this.validator.sendVideos(),
      this.controller.sendVideos.bind(this.controller)
    );
  }
  /**
   * Send audio social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/send-audio:
   *    post:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Send audio to social Network Whatsapps"
   *      description: "Send audio to social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "POSTsendAudioSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkWhatsappsSendAudioItem"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  sendAudios() {
    this.router.post(
      "/send-audio",
      AuthMiddleware,
      this.validator.sendAudios(),
      this.controller.sendAudios.bind(this.controller)
    );
  }
  sendStory() {
    this.router.post(
      "/story",
      AuthMiddleware,
      upload.single("file"),
      this.controller.sendStory.bind(this.controller)
    );
  }
  /**
   * Get session social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps/session/{id}:
   *    get:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Get session social Network Whatsapps"
   *      description: "List session social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "GETsessionSocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      - $ref: '#/components/parameters/pageParam'
   *      - $ref: '#/components/parameters/limitParam'
   *      - name: "id"
   *        in: "path"
   *        description: "Session of social Network Whatsapp to return"
   *        required: true
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  session() {
    this.router.get(
      "/session/:id",
      AuthMiddleware,
      this.validator.session(),
      this.controller.session.bind(this.controller)
    );
  }
  /**
   * Get all social Network Whatsapps
   * @swagger
   * /social-networks/whatsapps:
   *    get:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Get all social Network Whatsapps"
   *      description: "List all social Network Whatsapps with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "GETsocialNetworkWhatsapps"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      - $ref: '#/components/parameters/pageParam'
   *      - $ref: '#/components/parameters/limitParam'
   *      - name: "sort"
   *        in: "query"
   *        description: "The type of sort of items to return."
   *        required: false
   *        schema:
   *          type: "string"
   *          enum: [createdAt, -createdAt]
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemsSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  /**
   * Find social Network Whatsapp by ID
   * @swagger
   * /social-networks/whatsapps/{id}:
   *    get:
   *      tags:
   *        - SocialNetworksWhatsapp
   *      summary: "Find social Network Whatsapp by ID"
   *      description: "Returns a single social Network Whatsapp"
   *      security:
   *        - bearerAuth: []
   *      operationId: "GETsocialNetworkWhatsapp"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      - name: "id"
   *        in: "path"
   *        description: "ID of social Network Whatsapp to return"
   *        required: true
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemSchema'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemSchema'
   *        "401":
   *          description: "Not allow because you need a Authentication Token"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        '403':
   *          description: "Not allow because you need more permissions"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        "404":
   *          description: "Social Network Whatsapps not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  /**
     * Add a social Network Whatsapp
     * @swagger
     * /social-networks/whatsapps/{id}:
     *    post:
     *      tags:
     *        - SocialNetworksWhatsapp
     *      summary: "Add a social Network Whatsapp"
     *      description: "Add a social Network Whatsapp"
     *      operationId: "ADDsocialNetworkWhatsapp"
     *      security:
     *        - bearerAuth: []
     *      parameters:
     *      - $ref: '#/components/parameters/store'
     *      requestBody:
     *        content:
     *          application/json:
     *            schema:
     *              $ref: "#/definitions/SocialNetworkWhatsappsCreateItemSchema"
     *      responses:
     *        "200":
     *          description: "successful operation"
     *          content:
     *            application/json:
     *              schema:
     *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemSchema'
     *        "201":
     *          description: "Created successfully"
     *          content:
     *            application/json:
     *              schema:
     *                $ref: '#/definitions/SocialNetworkWhatsappsGetItemSchema'
     *        "401":
     *          description: "Not allow because you need a Authentication Token"
     *          content:
     *            application/json:
     *              schema:
     *                $ref: '#/definitions/ErrorSchema'
     *        '403':
     *          description: "Not allow because you need more permissions"
     *          content:
     *            application/json:
     *              schema:
     *                $ref: '#/definitions/ErrorSchema'
     *        "404":
     *          description: "samplesComment not found"
     *          content:
     *            application/json:
     *              schema:
     *                $ref: '#/definitions/ErrorSchema'
     *        default:
     *          description: "Unexpected Error"
     *          content:
     *            application/json:
     *              schema:
     *                $ref: '#/definitions/ErrorSchema'
     */
}

export const socialNetworkWhatsappsRouter = new SocialNetworkWhatsappsRoute(
  controller,
  router
).init();
