/**
 * @license Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md.
 */

'use strict';

const buildRelations = require( '@ckeditor/jsdoc-plugins/lib/relation-fixer/buildrelations' );
const addMissingDoclets = require( '@ckeditor/jsdoc-plugins/lib/relation-fixer/addmissingdoclets' );

/**
 * Builds relation chains between doclets and adds missing derived doclets.
 * Used because JSDoc and JSDuck do not add all derived data by default.
 *
 * @param doclets
 * @returns {Array.<Doclet>}
 */
module.exports = doclets => {
	return addMissingDoclets( buildRelations( doclets ) );
};
