import { OnInit, ChangeDetectorRef, EventEmitter } from '@angular/core';
import { Observable } from 'rxjs';
import { TypeaheadMatch } from 'ngx-bootstrap/typeahead';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { NgControl, ControlValueAccessor } from '@angular/forms';
import { Address } from '../../models/address.model';
import { AbstractFormControl } from '../../models/abstract-form-control';
import { ErrorMessage } from '../../models/error-message.interface';
/**
 * For TemplateForms, pass in an Address and recieve an Address
 * @example
 *           <common-address-validator
 *               label='Physical Address'
 *               [(ngModel)]="myAddress">
 *           </common-address-validator>
 *
 * @note
 * For ReactiveForms, pass in a string and recieve a string.  If you need the
 * Address object you can use (select) in addition.
 *
 * @example
 *           <common-address-validator
 *              label='Physical Address'
 *              formControlName="address"
 *              (select)="getAddressObject($event)">
 *          </common-address-validator>
 */
export interface AddressResult {
    /** String from the API that includes street, city, province, and country. */
    AddressComplete: string;
    HouseNumber: string;
    SubBuilding: string;
    Street: string;
    Locality: string;
    DeliveryAddressLines: string;
    AddressLines: Array<string>;
    Country: string;
    Province: string;
    PostalCode: string;
}
export declare class AddressValidatorComponent extends AbstractFormControl implements OnInit, ControlValueAccessor {
    controlDir: NgControl;
    private cd;
    protected http: HttpClient;
    label: string;
    address: string;
    serviceUrl: string;
    populateAddressOnSelect: boolean;
    addressChange: EventEmitter<string>;
    select: EventEmitter<Address>;
    maxlength: string;
    _defaultErrMsg: ErrorMessage;
    /** The string in the box the user has typed */
    search: string;
    /** Is the request still in progress? */
    isTypeaheadLoading: boolean;
    /** has returned and has no results, an empty array. */
    hasNoResults: boolean;
    hasError: boolean;
    /** Similar to this.address, but we can null it when user is searching for new addresses */
    selectedAddress: boolean;
    /** The list of results, from API, that is passed to the typeahead list */
    typeaheadList$: Observable<AddressResult[]>;
    /** The subject that triggers on user text input and gets typeaheadList$ to update.  */
    private searchText$;
    _onChange: (_: any) => void;
    _onTouched: (_?: any) => void;
    constructor(controlDir: NgControl, cd: ChangeDetectorRef, http: HttpClient);
    ngOnInit(): void;
    onError(err: any): Observable<AddressResult[]>;
    onLoading(val: boolean): void;
    onNoResults(val: boolean): void;
    onSelect(event: TypeaheadMatch): void;
    onKeyUp(event: KeyboardEvent): void;
    onBlur(event: any): void;
    writeValue(value: any): void;
    setSearchValue(value: any): void;
    registerOnChange(fn: any): void;
    registerOnTouched(fn: any): void;
    private stripStringToMaxLength;
    lookup(address: string): Observable<AddressResult[]>;
    /**
     * Formats the response from ADDRESS_URL, trimming irrelevant fields.
     *
     * This works for other requests for the same API too, however it may error
     * out on some items if matchPrecisionNot is not set.
     *
     * @param obj The response from ADDRESS_URL
     */
    protected processResponse(obj: any): AddressResult[];
    protected handleError(error: HttpErrorResponse): Observable<never>;
}
