/*!
 * Paradigm Framework - Angular Wrapper
 * Copyright (c) 2017 Miracle Devs, Inc
 * Licensed under MIT (https://github.com/MiracleDevs/Paradigm.Web.Angular/blob/master/LICENSE)
 */
import { OnDestroy, OnInit, Injector, Type } from '@angular/core';
import { MessageBusService, RegistrationToken, MessageHandler } from '../services/message-bus.service';
import { AlertService } from '../services/alert.service';
export declare class ComponentBase implements OnInit, OnDestroy {
    protected injector: Injector;
    /**
     * Reference to a message bus service.
     */
    private messageBus;
    /**
     * Array of message bus registration tokens that needs to be
     * unregistered before destroying the component.
     */
    private messageTokens;
    /**
     * Reference to an alert service.
     */
    private alerts;
    /**
     * Creates a new instance of @see ComponentBase
     * @param injector reference to an injector service.
     */
    constructor(injector: Injector);
    /**
     * Called when the component is initialized.
     */
    ngOnInit(): void;
    /**
     * Called when the component is destroyed.
     */
    ngOnDestroy(): void;
    /**
     * Gets a reference to the message bus.
     */
    protected getMessageBus(): MessageBusService;
    /**
     * Registers a message handler for a given message type.
     * @param type the message type.
     * @param handler the message handler to process when some part of the application sends a message of type @see type
     */
    protected registerMessage<T>(type: Type<T>, handler: MessageHandler<T>): void;
    /**
     * Unregisters all the tokens registered within this component.
     */
    protected unregisterTokens(): void;
    /**
     * Unregisters a particular token.
     * If no unregister take place, the component will unregister all the tokens
     * on @see ngOnDestroy
     * @param type the type of message to unregister
     */
    protected unregisterToken<T>(type: Type<T>): void;
    /**
     * Sends a message using the message bus.
     * @param message The message instance to send using the message bus.
     * @param token if specified, the component can target one specific registration token and handler;
     * if not, all the handlers registered for this message type, will receive the message.
     */
    protected sendMessage<T>(message: T, token?: RegistrationToken<T>): Promise<void>;
    /**
     * Gets the alert service.
     */
    protected getAlerts(): AlertService;
    /**
     * Adds a message in the alert service.
     * @param message message to add.
     */
    protected addMessage(message: string): void;
    /**
     * Adds a warning in the alert service.
     * @param warning warning to add.
     */
    protected addWarning(warning: string): void;
    /**
     * Adds an error in the alert service.
     * @param error error to add.
     */
    protected addError(error: string): void;
    /**
     * Handles an application error, reporting the error to the alert service.
     * @param error the error that needs to be handled.
     */
    protected handleError(error: any): void;
}
