'use strict';
define(function() {
  var NominatimFactory = function($http) {
    var NominatimFactory = {};
    /**
     * Class : NominatimFactory
     * Factory WebServices
     * Access to nominatim
     */

    /**
     * Function: search
     */
    function search(q) {
      var promise = $http.get(
        'https://nominatim.openstreetmap.org/search?q=' +
          q +
          '&format=json&polygon_geojson=1&addressdetails=1'
      );

      return promise;
    }

    return {
      NominatimFactory: NominatimFactory,
      search: search,
    };
  };

  NominatimFactory.$inject = ['$http'];
  return NominatimFactory;
});
