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

export class RolesEndpointsValidator extends AbstractValidator {
  constructor() {
    super();
  }
  avoidCheck() {
    return [
      check("_id").exists().isMongoId(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  setPermissions() {
    return [
      check("_id").exists().isMongoId(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  createItem() {
    return [
      check("endpoint_id").exists(),
      check("role_id").exists().isMongoId(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
  updateItem() {
    return [
      check("_id").exists().isMongoId(),
      check("endpoint_id").exists(),
      check("role_id").exists().isMongoId(),
      (req, res, next) => {
        validateResult(req, res, next);
      },
    ];
  }
}
