/** 
* namespace FdtWebUi
*/

declare namespace FdtWebUi 
{
	/**
	 * The message that can be passed into a logger. A string or a lambda returning one of these.
	 */
	export type StringLambdaType = string | (() => string);

	/**
	 * The error that can be passed into a logger. An Error, null or a lambda returning one of these.
	 */
	export type ErrorLambdaType = Error | null | (() => Error | null);

	/**
	 * The IWebTrace interface used for tracing.
	 *
	 * Usage: call debug(), trace(), info(), warn(), error() or critical() method to send a message with desired logging level to the Frame Application.
	 * All of these methods expect a context and message, optionally an error.
	 * The context describes the message source which usually is an application / component / class.
	 * The 'debug, trace, [info], warn, error, critical' notation used for methods description to visualize 
	 * the tracing level of desired method using square brackets. 
	 *
	 * Sample: logger.debug("My.First.App", "Hello world");
	 *         logger.error("My.First.App.ComponentX", "This is an error", new Error("fail"));
	 */
	export interface IWebTrace {

		/**
		 * Writes [debug], trace info, warn, error, critical messages to log.
		 * @param context {StringLambdaType} Describes the message source which usually is an application / component / class.
		 * @param message {StringLambdaType} The message to write.
		 * @param error {ErrorLambdaType} An optional error that belongs to the message.
		 */
		debug(context: StringLambdaType, message: StringLambdaType, error?: ErrorLambdaType): void;

		/**
		 * Writes debug, [trace], info, warn, error, critical messages to log.
		 * @param context {StringLambdaType} Describes the message source which usually is an application / component / class.
		 * @param message {StringLambdaType} The message to write.
		 * @param error {ErrorLambdaType} An optional error that belongs to the message.
		 */
		trace(context: StringLambdaType, message: StringLambdaType, error?: ErrorLambdaType): void;

		/**
		 * Writes debug, trace, [info], warn, error, critical messages to log.
		 * @param context {StringLambdaType} Describes the message source which usually is an application / component / class.
		 * @param message {StringLambdaType} The message to write.
		 * @param error {ErrorLambdaType} An optional error that belongs to the message.
		 */
		info(context: StringLambdaType, message: StringLambdaType, error?: ErrorLambdaType): void;

		/**
		 * Writes debug, trace, info, [warn], error, critical messages to log.
		 * @param context {StringLambdaType} Describes the message source which usually is an application / component / class.
		 * @param message {StringLambdaType} The message to write.
		 * @param error {ErrorLambdaType} An optional error that belongs to the message.
		 */
		warn(context: StringLambdaType, message: StringLambdaType, error?: ErrorLambdaType): void;

		/**
		 * Writes debug, trace, info, warn, [error], critical messages to log.
		 * @param context {StringLambdaType} Describes the message source which usually is an application / component / class.
		 * @param message {StringLambdaType} The message to write.
		 * @param error {ErrorLambdaType} An optional error that belongs to the message.
		 */
		error(context: StringLambdaType, message: StringLambdaType, error?: ErrorLambdaType): void;

		/**
		 * Writes debug, trace, info, warn, error, [critical] messages to log.
		 * @param context {StringLambdaType} Describes the message source which usually is an application / component / class.
		 * @param message {StringLambdaType} The message to write.
		 * @param error {ErrorLambdaType} An optional error that belongs to the message.
		 */
		critical(context: StringLambdaType, message: StringLambdaType, error?: ErrorLambdaType): void;

		/**
		 * Gets whether the debug logging level is enabled, i.e. debug messages will be written to the log.
		 */
		isDebugEnabled(): boolean;

		/**
		 * Gets whether the trace logging level is enabled, i.e. trace messages will be written to the log.
		 */
		isTraceEnabled(): boolean;

		/**
		 * Gets whether the info logging level is enabled, i.e. info messages will be written to the log.
		 */
		isInfoEnabled(): boolean;

		/**
		 * Gets whether the warn logging level is enabled, i.e. warn messages will be written to the log.
		 */
		isWarnEnabled(): boolean;

		/**
		 * Gets whether the error logging level is enabled, i.e. error messages will be written to the log.
		 */
		isErrorEnabled(): boolean;

		/**
		 * Gets whether the critical logging level is enabled, i.e. critical messages will be written to the log.
		 */
		isCriticalEnabled(): boolean;

	}
}