import { check } from "express-validator";
import { validateResult } from "../../utils/handlers/validator.handle";
import { AbstractValidator } from "../abstract.validator";

export class SocialNetworkWhatsappsValidator extends AbstractValidator {
  constructor() {
    super();
  }
  session() {
    return [
      check("id").exists().isString(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  connect() {
    return [
      check("username").exists().isString(),
      check("provider_id").exists().isMongoId(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  sendMessages() {
    return [
      check("username").exists().isString(),
      check("list").exists().isArray({ min: 1 }),
      check("list.*.number").exists().isString(),
      check("list.*.message").exists().isString(),
      check("list.*.options").optional().isObject(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  sendPhotos() {
    return [
      check("username").exists().isString(),
      check("list").exists().isArray({ min: 1 }),
      check("list.*.number").exists().isString(),
      check("list.*.message").exists().isString(),
      check("list.*.options").optional().isObject(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  sendVideos() {
    return [
      check("username").exists().isString(),
      check("list").exists().isArray({ min: 1 }),
      check("list.*.number").exists().isString(),
      check("list.*.message").exists().isString(),
      check("list.*.options").optional().isObject(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  sendAudios() {
    return [
      check("username").exists().isString(),
      check("list").exists().isArray({ min: 1 }),
      check("list.*.number").exists().isString(),
      check("list.*.message").exists().isString(),
      check("list.*.options").optional().isObject(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  createItem() {
    return [
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  updateItem() {
    return [
      check("_id").exists().isMongoId(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
}
