/*!
 * Paradigm Framework - Angular Wrapper
 * Copyright (c) 2017 Miracle Devs, Inc
 * Licensed under MIT (https://github.com/MiracleDevs/Paradigm.Web.Shared/blob/master/LICENSE)
 */
import { ServiceBase } from './base.service';
/**
 * Represents the response of the geolocation service.
 */
export interface Coordinate {
    /**
     * the latitude as a decimal number (always returned).
     */
    latitude: number;
    /**
     * the longitude as a decimal number (always returned).
     */
    longitude: number;
    /**
     * the accuracy of position (always returned).
     */
    accuracy?: number;
    /**
     * the altitude in meters above the mean sea level (returned if available).
     */
    altitude?: number;
    /**
     * the altitude accuracy of position (returned if available).
     */
    altitudeAccuracy?: number;
    /**
     * the heading as degrees clockwise from North (returned if available).
     */
    heading?: number;
    /**
     * the speed in meters per second (returned if available).
     */
    speed?: number;
}
/**
 * Represents the @see navigator.geolocation options.
 */
export interface IPositionOptions {
    /**
     * Indicates if the geolocation should have high accuracy to find the current position.
     */
    enableHighAccuracy?: boolean;
    /**
     * A timeout value for the geolocation query.
     */
    timeout?: number;
    /**
     * The maximum age for the request.
     */
    maximumAge?: number;
}
/**
 * Represents a geolocation watcher.
 * It listens for geolocation events.
 */
export declare class GeolocationWatcher {
    private geolocation;
    /**
     * The geolocation watch operation index.
     */
    private watchIndex;
    /**
     * Indicates if the watcher is being unregistered.
     */
    private beingUnregistered;
    /**
     * Event called when the geolocation service reports new geolocation information.
     * @param coordinates the new geolocation coordinates.
     */
    onInformationReceived: (coordinates: Coordinate) => void;
    /**
     * Event called when the geolocation service found an error.
     * @param error the error found.
     */
    onError: (error: string) => void;
    /**
     * Creates a new instance of @see GeolocationWatcher
     * @param geolocation a reference to the geolocation service.
     */
    constructor(geolocation: IGeolocationProvider);
    /**
     * Register the watcher and stores the watch operation index.
     * @param index the index representing this watch operation.
     */
    register(index: number): void;
    /**
     * Unregisters the watcher.
     * Once unregistered, the watcher does not receives any more events.
     */
    unregister(): void;
    /**
     * Gets the watch index.
     */
    getWatchIndex(): number;
    /**
     * Indicates if this watcher is disposed.
     */
    isDisposed(): boolean;
    /**
     * Indicates if the watcher is being unregistered.
     */
    isBeingUnregistered(): boolean;
}
/**
 * Provides a common interface for different geolocation providers.
 */
export interface IGeolocationProvider {
    /**
     * Indicates if the geolocation provider is available.
     */
    isAvailable(): boolean;
    /**
     * Gets the current geolocation.
     */
    getGeolocation(): Promise<Coordinate>;
    /**
     * Registers a new geolocation watcher.
     */
    registerWatcher(): GeolocationWatcher;
    /**
     * Unregisters a geolocation watcher.
     * @param watcher the watcher that will be unregistered.
     */
    unregisterWatcher(watcher: GeolocationWatcher): void;
}
/**
 * Implements the geolocation provider api using the @see navigator.geolocation
 */
export declare class NavigationGeolocationProvider implements IGeolocationProvider {
    private options?;
    /**
     * Creates a new instance of @see NavigationGeolocationProvider
     * @param options geolocation options.
     */
    constructor(options?: IPositionOptions);
    /**
     * Gets the current geolocation if a service geolocation service is available.
     */
    getGeolocation(): Promise<Coordinate>;
    /**
     * Registers a geolocation watcher to lister for geolocation events.
     */
    registerWatcher(): GeolocationWatcher;
    /**
     * Unregisters the geolocation watcher.
     * @param watcher the watcher that will be unregistered.
     */
    unregisterWatcher(watcher: GeolocationWatcher): void;
    /**
     * Indicates if the geolocation service is available.
     */
    isAvailable(): boolean;
    /**
     * Gets the geolocation service.
     */
    private getGeoLocator;
}
export declare class GeolocationService extends ServiceBase {
    /**
     * Reference to a geolocation provider.
     */
    private geolocationProvider;
    /**
     * Creates a new instance of @see GeolocationService
     * By default @see GeolocationService uses @see NavigationGeolocationProvider as provider.
     * The provider can be changed using @see GeolocationService.setGeolocationProvider
     */
    constructor();
    /**
     * Sets the geolocation provider.
     * @param provider geolocation provider.
     */
    setGeolocationProvider(provider: IGeolocationProvider): void;
    /**
     * Gets the current geolocation if a service geolocation service is available.
     * @param options the geolocation options.
     */
    getGeolocation(): Promise<Coordinate>;
    /**
     * Registers a geolocation watcher to lister for geolocation events.
     * @param options the geolocation options.
     */
    registerWatcher(): GeolocationWatcher;
    /**
     * Indicates if the geolocation service is available.
     */
    isAvailable(): boolean;
}
