import React from 'react';
import { getBooleanAttribute, getNumericAttribute, mapChildElements } from '../../dom-utils';
import { withContext } from './withContext';
export const SectionContext = React.createContext({});
export const withSectionContext = withContext(SectionContext, ({ element }) => {
    const casForbidden = getBooleanAttribute(element, 'cas-forbidden');
    const displayNumber = element.getAttribute('display-number');
    const maxAnswers = getNumericAttribute(element, 'max-answers');
    const minAnswers = getNumericAttribute(element, 'min-answers');
    const maxScore = getNumericAttribute(element, 'max-score');
    const childQuestions = mapChildElements(element, childElement => childElement).filter(parentNode => parentNode.localName === 'question');
    return {
        casForbidden,
        displayNumber,
        maxAnswers,
        minAnswers,
        maxScore,
        childQuestions
    };
});
//# sourceMappingURL=SectionContext.js.map