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

'use strict';

const AbstractParser = require( './abstractparser' );

module.exports = class ErrorParser extends AbstractParser {
	/**
	 * @param {BaseReflection} item
	 * @returns {Boolean}
	 */
	canParse( item ) {
		return item.isCKEditor5Error === true;
	}

	/**
	 * @param {CKEditor5ErrorReflection} item
	 * @returns {Object}
	 */
	parse( item ) {
		return {
			_signature: [ {}, item ],

			kind: this.getKind( item ),
			scope: 'inner',
			name: item.name,
			longname: `module:errors/${ item.name }`,
			extraId: this.getExtraId( item ),
			description: this.getComment( item ),

			// This property will be filled in the post-processing phase.
			params: null
		};
	}
};
