/**
 * @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' );
const ReflectionKind = require( './reflectionkind' );

module.exports = class InterfaceParser extends AbstractParser {
	/**
	 * @param {BaseReflection} item
	 * @returns {Boolean}
	 */
	canParse( item ) {
		return item.kind === ReflectionKind.Interface;
	}

	/**
	 * @param {InterfaceReflection} item
	 * @param {String} parentName
	 * @returns {Object}
	 */
	parse( item, parentName ) {
		return {
			// Needed for post-processing once all project reflections are converted.
			_signature: item,

			id: item.id,
			name: item.name,
			memberof: parentName,
			longname: this.getLongName( item, parentName ),

			scope: this.getScope( item ),
			kind: this.getKind( item ),
			extraId: this.getExtraId( item ),
			description: this.getComment( item ),
			file: this.getFile( item ),
			skipSource: this.shouldSkipSource( item ),
			deprecated: this.isDeprecated( item ),

			typeParameters: null,
			augmentsNested: null,
			descendants: null
		};
	}
};
