function validateSelection(oPlugin, oBinding, oContext) {
		const oHeaderContext = oBinding.getHeaderContext();
		let aContextsToValidate = [];

		if (oContext) {
			aContextsToValidate = oContext.isSelected() ? [oContext] : [];
		} else {
			aContextsToValidate = oPlugin.getSelectedContexts();

			if (oHeaderContext?.isSelected()) {
				aContextsToValidate.unshift(oHeaderContext);
			}
		}

		for (const oContext of aContextsToValidate) {
			// To avoid compatibility issues if support is added. Handling a selected header context might affect UI, behavior, and settings.
			if (oContext === oHeaderContext) {
				throw new Error("Header context must not be selected");
			}

			// To avoid compatibility issues if support is added. Handling selected sums and group headers might affect UI, behavior, and settings.
			if (!isContextSelectable(oContext)) {
				throw new Error(`Context ${oContext} is not allowed to be selected`);
			}
		}

		if (oPlugin.getSelectionMode() === SelectionMode.Single && oPlugin.getSelectedCount() > 1) {
			throw new Error("Multiple contexts selected. Cannot select more than one context in selection mode 'Single'");
		}
	}
Validates the selection of contexts.

@param {object} oPlugin The table plugin instance.
@param {object} oBinding The binding instance associated with the table.
@param {object} [oContext] The specific context to validate. If not provided, all selected contexts are validated.
@throws {Error} If the header context is selected.
@throws {Error} If a context that is not selectable is selected.
@throws {Error} If multiple contexts are selected in 'Single' selection mode.