// Generated by CoffeeScript 2.3.2
(function() {
  var ConfigNode, SearchResponseParser, mapObj, sup;

  sup = require("../response-parser-support");

  ({ConfigNode} = require("@l.degener/irma-config"));

  mapObj = function(obj, f) {
    var k, r, v;
    r = {};
    for (k in obj) {
      v = obj[k];
      r[k] = f(v);
    }
    return r;
  };

  module.exports = SearchResponseParser = class SearchResponseParser extends ConfigNode {
    transform(searchRequest, settings) {
      var _ast, _request, facetCounts, hits, offset, sections, suggestions, total;
      ({facetCounts, sections, suggestions, hits, _request, _ast, offset, total} = mapObj(sup, function(f) {
        return f(searchRequest, settings);
      }));
      return function(response) {
        return {
          hits: hits(response),
          _request: _request(response),
          _ast: _ast(response),
          offset: offset(response),
          total: total(response),
          facetCounts: facetCounts(response),
          sections: sections(response),
          suggestions: suggestions(response)
        };
      };
    }

  };

}).call(this);
