text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  const tslib_1 = require("tslib");
  const decorators_1 = require("../decorators");
  const index_1 = require("../index");
  const is_uuid_1 = require("../utils/is-uuid");
  let ParseUUIDPipe = class ParseUUIDPipe {
      constructor(options) {
          options = options || {};
          this.version = options.version;
          this.exceptionFactory =
              options.exceptionFactory || (error => new index_1.BadRequestException(error));
      }
      async transform(value, metadata) {
          if (!is_uuid_1.isUUID(value, this.version)) {
              throw this.exceptionFactory(`Validation failed (uuid ${this.version ? 'v' + this.version : ''} is expected)`);
          }
          return value;
      }
  };
  ParseUUIDPipe = tslib_1.__decorate([
      index_1.Injectable(),
      tslib_1.__param(0, decorators_1.Optional()),
      tslib_1.__metadata("design:paramtypes", [Object])
  ], ParseUUIDPipe);
  exports.ParseUUIDPipe = ParseUUIDPipe;
  