import { JSONAPISerializer } from 'ember-cli-mirage';

import _ from 'lodash';

export default JSONAPISerializer.extend({
    serialize(response, request) {
      var map = response.models.find(map => map.id === request.queryParams['area']);
        return {'geostats': _(map && map.areas || {}).map((geostat) => { return [geostat.id, geostat.count];}).fromPairs().value()};
    }
});
