"use strict";

exports.__esModule = true;
exports.default = void 0;
var _tsMixer = require("ts-mixer");
var _apidomNsOpenapi = require("@swagger-api/apidom-ns-openapi-3-1");
var _predicates = require("../../../../predicates.cjs");
/**
 * @public
 */

/**
 * @public
 */
class ContentVisitor extends (0, _tsMixer.Mixin)(_apidomNsOpenapi.MapVisitor, _apidomNsOpenapi.FallbackVisitor) {
  constructor(options) {
    super(options);
    this.element = new _apidomNsOpenapi.RequestBodyContentElement();
    this.specPath = element => (0, _apidomNsOpenapi.isReferenceLikeElement)(element) ? ['document', 'objects', 'Reference'] : ['document', 'objects', 'MediaType'];
  }
  ObjectElement(objectElement) {
    const result = _apidomNsOpenapi.MapVisitor.prototype.ObjectElement.call(this, objectElement);

    // decorate every ReferenceElement with metadata about their referencing type
    // @ts-ignore
    this.element.filter(_predicates.isReferenceElement).forEach(referenceElement => {
      // @ts-ignore
      referenceElement.setMetaProperty('referenced-element', 'mediaType');
    });
    return result;
  }
}
var _default = exports.default = ContentVisitor;