import { SocialNetworkEmailsController } from "../../controllers/social-network/social-network-email.controller";
import { AuthMiddleware } from "../../middleware/auth.middleware";
import { SocialNetworkEmailsValidator } from "../../validators/social-network/social-network-email.validator";
import { AbstractRoute } from "../abstract.route";

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

class SocialNetworkEmailsRoute extends AbstractRoute {
  constructor(_controller, _router) {
    super(_controller, _router, new SocialNetworkEmailsValidator(), [
      "getItem",
      "getItems",
      "createItem",
      "sendEmail",
      "sendVerification",
      "verify",
    ]);
  }
  /**
   * Get all email social network
   * @swagger
   * /social-networks/emails:
   *    get:
   *      tags:
   *        - SocialNetworksEmail
   *      summary: "Get all email"
   *      description: "List all email with details"
   *      security:
   *        - bearerAuth: []
   *      operationId: "GETemailsSocialNetwork"
   *      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/SocialNetworkEmailsGetItems'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsGetItems'
   *        "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'
   */
  /**
   * Find email social network by ID
   * @swagger
   * /social-networks/emails/{id}:
   *    get:
   *      tags:
   *        - SocialNetworksEmail
   *      summary: "Find email by ID"
   *      description: "Returns a single email"
   *      security:
   *        - bearerAuth: []
   *      operationId: "GETemailSocialNetwork"
   *      produces:
   *      - "application/xml"
   *      - "application/json"
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      - name: "id"
   *        in: "path"
   *        description: "ID of email to return"
   *        required: true
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsGetItem'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsGetItem'
   *        "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'
   */
  /**
   * Add a samplesComment
   * @swagger
   * /social-networks/emails:
   *    post:
   *      tags:
   *        - SocialNetworksEmail
   *      summary: "Add a email"
   *      description: "Add a email"
   *      operationId: "ADDemailSocialNetwork"
   *      security:
   *        - bearerAuth: []
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkEmailsCreateItem"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsGetItem'
   *        "201":
   *          description: "Created successfully"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsGetItem'
   *        "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'
   */

  /**
   * Send email
   * @swagger
   * /social-networks/emails/send:
   *    post:
   *      tags:
   *        - SocialNetworksEmail
   *      summary: "Send a Email"
   *      description: "Send a Email"
   *      operationId: "SENDemailSocialNetwork"
   *      security:
   *        - bearerAuth: []
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkEmailsSendItem"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsResponseItem'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsResponseItem'
   *        "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 Instagrams not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  sendEmail() {
    this.router.post(
      "/send",
      AuthMiddleware,
      this.validator.sendEmail(),
      this.controller.sendEmail.bind(this.controller)
    );
  }
  /**
   * Send verification to social network email
   * @swagger
   * /social-networks/emails/send-verification:
   *    post:
   *      tags:
   *        - SocialNetworksEmail
   *      summary: "Send verification a Email"
   *      description: "Send verification a Email"
   *      operationId: "SENDVerificationEmailSocialNetwork"
   *      security:
   *        - bearerAuth: []
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkEmailsSendVerification"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsResponseItem'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsResponseItem'
   *        "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 Instagrams not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  sendVerification() {
    this.router.post(
      "/send-verification",
      AuthMiddleware,
      this.validator.sendVerification(),
      this.controller.sendVerification.bind(this.controller)
    );
  }
  /**
   * Verify code to social network email
   * @swagger
   * /social-networks/emails/verify:
   *    post:
   *      tags:
   *        - SocialNetworksEmail
   *      summary: "Verify a Email"
   *      description: "Verify a Email"
   *      operationId: "VERIFYemailSocialNetwork"
   *      security:
   *        - bearerAuth: []
   *      parameters:
   *      - $ref: '#/components/parameters/store'
   *      requestBody:
   *        content:
   *          application/json:
   *            schema:
   *              $ref: "#/definitions/SocialNetworkEmailsSendVerify"
   *      responses:
   *        "200":
   *          description: "successful operation"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsResponseItem'
   *        "204":
   *          description: "successful operation with empty respose"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/SocialNetworkEmailsResponseItem'
   *        "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 Instagrams not found"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   *        default:
   *          description: "Unexpected Error"
   *          content:
   *            application/json:
   *              schema:
   *                $ref: '#/definitions/ErrorSchema'
   */
  verify() {
    this.router.post(
      "/verify",
      AuthMiddleware,
      this.validator.verify(),
      this.controller.verify.bind(this.controller)
    );
  }
}

export const socialNetworkEmailsRouter = new SocialNetworkEmailsRoute(
  controller,
  router
).init();
