import axios from 'axios';
import AddressLookupGoogleService from './address-lookup-google-service';
import AddressLookupLoqateService from './address-lookup-loqate-service';
import AddressLookupGoogleProxyService from './address-lookup-proxy-google-service';
var AddressLookupPlugin = {
    install: function (v, options) {
        if (options === void 0) { options = { loqateKey: '', googleKey: '', googleProxy: {} }; }
        if (options.loqateKey && options.googleKey) {
            v.prototype.$log.error('The API key for Loqate Web Service OR Google Maps API must be provided');
        }
        var addressLookup = undefined;
        if (options.googleKey) {
            addressLookup = new AddressLookupGoogleService(axios, options.googleKey);
        }
        else if (options.loqateKey) {
            addressLookup = new AddressLookupLoqateService(axios, options.loqateKey);
        }
        else if (!(Object.keys(options.googleProxy).length === 0 && options.googleProxy.constructor === Object)) {
            addressLookup = new AddressLookupGoogleProxyService(options.googleProxy.findPromise, options.googleProxy.retrievePromise, options.googleProxy.findErrorCallback, options.googleProxy.retrieveErrorCallback);
        }
        else {
            v.prototype.$log.warn("You need to provide a Loqate Web Service, Google Maps API key or Proxies URL to Google.");
        }
        v.prototype.$addressLookup = addressLookup;
    }
};
export default AddressLookupPlugin;
//# sourceMappingURL=address-lookup.plugin.js.map