class OSMNamesQuery {
  countrycodes;
  q;
  service;
  count;

  toString() {
    const obj = this;
    const query =
      "?" +
      Object.keys(obj)
        .reduce(function (a, k) {
          a.push(k + "=" + encodeURIComponent(obj[k]));
          return a;
        }, [])
        .join("&");
    return query;
  }

  constructor(init) {
    if (init !== undefined) {
      Object.assign(this, init);
    } else {
      this.countrycodes = "PL";
      this.service = "osmnames";
      this.count = 10;
    }
  }
}

export default OSMNamesQuery;
