function Cesium3DTilesetMetadata(options) {
  options = options ?? Frozen.EMPTY_OBJECT;
  const metadataJson = options.metadataJson;

  // The calling code is responsible for loading the schema.
  // This keeps metadata parsing synchronous.
  const schema = options.schema;

  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("options.metadataJson", metadataJson);
  Check.typeOf.object("options.schema", schema);
  //>>includeEnd('debug');

  // An older schema stored the tileset metadata in the "tileset" property.
  const metadata = metadataJson.metadata ?? metadataJson.tileset;

  let tileset;
  if (defined(metadata)) {
    tileset = new TilesetMetadata({
      tileset: metadata,
      class: schema.classes[metadata.class],
    });
  }

  let groupIds = [];
  const groups = [];
  const groupsJson = metadataJson.groups;
  if (Array.isArray(groupsJson)) {
    const length = groupsJson.length;
    for (let i = 0; i < length; i++) {
      const group = groupsJson[i];
      groups.push(
        new GroupMetadata({
          group: group,
          class: schema.classes[group.class],
        }),
      );
    }
  } else if (defined(groupsJson)) {
    // An older version of group metadata stored groups in a dictionary
    // instead of an array.
    groupIds = Object.keys(groupsJson).sort();
    const length = groupIds.length;
    for (let i = 0; i < length; i++) {
      const groupId = groupIds[i];
      if (groupsJson.hasOwnProperty(groupId)) {
        const group = groupsJson[groupId];
        groups.push(
          new GroupMetadata({
            id: groupId,
            group: groupsJson[groupId],
            class: schema.classes[group.class],
          }),
        );
      }
    }
  }

  this._schema = schema;
  this._groups = groups;
  this._groupIds = groupIds;
  this._tileset = tileset;

  this._statistics = metadataJson.statistics;
  this._extras = metadataJson.extras;
  this._extensions = metadataJson.extensions;
}
An object containing metadata about a 3D Tileset.
<p>
See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_metadata|3DTILES_metadata Extension} for 3D Tiles.
</p>
<p>
This object represents the tileset JSON (3D Tiles 1.1) or the <code>3DTILES_metadata</code> object that contains
the schema ({@link MetadataSchema}), tileset metadata ({@link TilesetMetadata}), group metadata (dictionary of {@link GroupMetadata}), and metadata statistics (dictionary)
</p>

@param {object} options Object with the following properties:
@param {object} options.metadataJson Either the tileset JSON (3D Tiles 1.1) or the <code>3DTILES_metadata</code> extension object that contains the tileset metadata.
@param {MetadataSchema} options.schema The parsed schema.

@alias Cesium3DTilesetMetadata
@constructor
@private
@experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.