"use strict";

exports.__esModule = true;
exports.GmapsTestClientWithFields = exports.GmapsTestClient = exports.GEOCODE_RESULT = void 0;
var GEOCODE_RESULT = exports.GEOCODE_RESULT = {
  formatted_address: '_formatted_address_',
  address_components: [{
    types: ['street_number'],
    long_name: 123
  }],
  geometry: {
    location: {
      lat: () => 31.12,
      lng: () => 33.34
    }
  }
};
class GmapsTestClient {
  autocomplete(_ref) {
    var {
      request
    } = _ref;
    if (request.input === 'dontfind') {
      return Promise.resolve([]);
    }
    return Promise.resolve([{
      description: JSON.stringify(request) + ' - 1',
      id: 0
    }, {
      description: JSON.stringify(request) + ' - 2',
      id: 1
    }]);
  }
  geocode(_ref2) {
    var {
      request
    } = _ref2;
    var {
      address,
      placeId
    } = request;
    if (address || placeId) {
      return Promise.resolve([GEOCODE_RESULT]);
    }
    throw new Error('geocode() request params are malformed');
  }
  placeDetails(_ref3) {
    var {
      request
    } = _ref3;
    var {
      placeId
    } = request;
    if (placeId) {
      return Promise.resolve([GEOCODE_RESULT]);
    }
    throw new Error('placeDetails() request params are malformed');
  }
}
exports.GmapsTestClient = GmapsTestClient;
class GmapsTestClientWithFields extends GmapsTestClient {
  placeDetails(_ref4) {
    var {
      request
    } = _ref4;
    var {
      fields
    } = request;
    if (fields) {
      return Promise.resolve([GEOCODE_RESULT]);
    }
    throw new Error('placeDetails() request params are malformed');
  }
}
exports.GmapsTestClientWithFields = GmapsTestClientWithFields;
//# sourceMappingURL=gmapsTestClient.js.map