class FacetParserHelper extends FacetHelper {

    public static final Facet dateRange(final JsonNode facet, VarNameAdapter adapter)
        throws InvalidCreateOperationException, InvalidParseOperationException {
        final String name = facet.get(FACETARGS.NAME.exactToken()).asText();
        JsonNode dateRange = facet.get(FACET.DATE_RANGE.exactToken());
        ArrayNode ranges = (ArrayNode) dateRange.get(FACETARGS.RANGES.exactToken());

        String dateFormat = dateRange.get(FACETARGS.FORMAT.exactToken()).asText();

        List<RangeFacetValue> rangesList = new ArrayList<>();
        ranges.forEach(item -> {
            JsonNode from = item.get(FACETARGS.FROM.exactToken());
            JsonNode to = item.get(FACETARGS.TO.exactToken());
            rangesList.add(new RangeFacetValue(from != null && !from.isNull() ? from.asText() : null,
                to != null && !to.isNull() ? to.asText() : null));
        });

        String translatedNestedPath = null;
        if(dateRange.get(FACETARGS.SUBOBJECT.exactToken()) != null) {
            String nestedPath = dateRange.get(FACETARGS.SUBOBJECT.exactToken()).asText();
            translatedNestedPath = adapter.getVariableName(nestedPath);
            if(translatedNestedPath == null) {
                translatedNestedPath = nestedPath;
            }
        }

        String fieldName = dateRange.get(FACETARGS.FIELD.exactToken()).asText();
        String translatedFieldName = adapter.getVariableName(fieldName);
        if(translatedFieldName == null) {
            translatedFieldName = fieldName;
        }

        return FacetHelper.dateRange(name, translatedFieldName, translatedNestedPath, dateFormat, rangesList);

    }

    protected  FacetParserHelper();

}