import { type IDashboardCommand } from "../commands/base.js";
import { type IDashboardQuery } from "../queries/base.js";
import { type DashboardContext } from "../types/commonTypes.js";
import { type IDashboardEvent } from "./base.js";
/**
 * Payload of the {@link IDashboardCommandStarted} event.
 * @beta
 */
export interface IDashboardCommandStartedPayload<TCommand extends IDashboardCommand> {
    /**
     * The command that started processing.
     */
    readonly command: TCommand;
}
/**
 * This event is emitted when a particular command processing starts.
 *
 * @beta
 */
export interface IDashboardCommandStarted<TCommand extends IDashboardCommand> extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.COMMAND.STARTED";
    readonly payload: IDashboardCommandStartedPayload<TCommand>;
}
export declare function dashboardCommandStarted<TCommand extends IDashboardCommand>(ctx: DashboardContext, command: TCommand): IDashboardCommandStarted<TCommand>;
/**
 * Tests whether the provided object is an instance of {@link IDashboardCommandStarted}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardCommandStarted: (obj: unknown) => obj is IDashboardCommandStarted<any>;
/**
 * @beta
 */
export type ActionFailedErrorReason = "USER_ERROR" | "INTERNAL_ERROR";
/**
 * Payload of the {@link IDashboardCommandFailed} event.
 * @beta
 */
export interface IDashboardCommandFailedPayload<TCommand extends IDashboardCommand> {
    /**
     * Reason for the failure.
     */
    readonly reason: ActionFailedErrorReason;
    /**
     * Message explaining the nature of the failure.
     */
    readonly message: string;
    /**
     * Error that has occurred and caused the command to fail.
     */
    readonly error?: Error;
    /**
     * The command that failed.
     */
    readonly command: TCommand;
}
/**
 * This event is emitted if a particular command processing fails. The failure may be for two general reasons:
 *
 * -  A user error was made; dispatched command is found to have bad payload or the dispatched command is not applicable
 *    in the current state of the dashboard
 *
 * -  An internal error has occurred in the dashboard component - highly likely due to a bug.
 *
 * @beta
 */
export interface IDashboardCommandFailed<TCommand extends IDashboardCommand = IDashboardCommand> extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.COMMAND.FAILED";
    readonly payload: IDashboardCommandFailedPayload<TCommand>;
}
export declare function internalErrorOccurred<TCommand extends IDashboardCommand>(ctx: DashboardContext, command: TCommand, message: string, error?: Error): IDashboardCommandFailed<TCommand>;
export declare function invalidArgumentsProvided<TCommand extends IDashboardCommand>(ctx: DashboardContext, command: TCommand, message: string): IDashboardCommandFailed<TCommand>;
/**
 * Tests whether the provided object is an instance of {@link IDashboardCommandFailed}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardCommandFailed: (obj: unknown) => obj is IDashboardCommandFailed<any>;
/**
 * This event is emitted when the submitted command has been rejected by the dashboard component because it does
 * not know how to handle the command.
 *
 * This typically indicates user error, perhaps a typo in the command type name.
 *
 * @beta
 */
export interface IDashboardCommandRejected extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.COMMAND.REJECTED";
}
export declare function commandRejected(ctx: DashboardContext, correlationId?: string): IDashboardCommandRejected;
/**
 * Tests whether the provided object is an instance of {@link IDashboardCommandRejected}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardCommandRejected: (obj: unknown) => obj is IDashboardCommandRejected;
/**
 * This event is emitted when the submitted query has been rejected by the dashboard component because it does
 * not know how to handle the query.
 *
 * @beta
 */
export interface IDashboardQueryRejected extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.QUERY.REJECTED";
}
export declare function queryRejected(ctx: DashboardContext, correlationId?: string): IDashboardQueryRejected;
/**
 * Tests whether the provided object is an instance of {@link IDashboardQueryRejected}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardQueryRejected: (obj: unknown) => obj is IDashboardQueryRejected;
/**
 * Payload of the {@link IDashboardQueryFailed} event.
 * @beta
 */
export interface IDashboardQueryFailedPayload {
    /**
     * Reason for the failure.
     */
    readonly reason: ActionFailedErrorReason;
    /**
     * Message explaining the nature of the failure.
     */
    readonly message: string;
    /**
     * Error that has occurred and caused the command to fail.
     */
    readonly error?: Error;
}
/**
 * This event is emitted if a particular query processing fails. The failure may be for two general reasons:
 *
 * -  A user error was made; dispatched query is found to have bad payload or the dispatched query is not applicable
 *    in the current state of the dashboard
 *
 * -  An internal error has occurred in the dashboard component - highly likely due to a bug.
 *
 * @beta
 */
export interface IDashboardQueryFailed extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.QUERY.FAILED";
    readonly payload: IDashboardQueryFailedPayload;
}
export declare function internalQueryErrorOccurred(ctx: DashboardContext, message: string, error?: Error, correlationId?: string): IDashboardQueryFailed;
export declare function invalidQueryArguments(ctx: DashboardContext, message: string, correlationId?: string): IDashboardQueryFailed;
/**
 * Tests whether the provided object is an instance of {@link IDashboardCommandFailed}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardQueryFailed: (obj: unknown) => obj is IDashboardQueryFailed;
/**
 * Payload of the {@link IDashboardQueryStarted} event.
 * @beta
 */
export interface IDashboardQueryStartedPayload {
    /**
     * The query that is starting to be run.
     */
    readonly query: IDashboardQuery;
}
/**
 * This event is emitted when query processing starts.
 *
 * @beta
 */
export interface IDashboardQueryStarted extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.QUERY.STARTED";
    readonly payload: IDashboardQueryStartedPayload;
}
export declare function queryStarted(ctx: DashboardContext, query: IDashboardQuery, correlationId?: string): IDashboardQueryStarted;
/**
 * Tests whether the provided object is an instance of {@link IDashboardQueryStarted}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardQueryStarted: (obj: unknown) => obj is IDashboardQueryStarted;
/**
 * Payload of the {@link IDashboardQueryCompleted} event.
 * @beta
 */
export interface IDashboardQueryCompletedPayload<TQuery extends IDashboardQuery, TResult> {
    /**
     * The query that was run to get the given result.
     */
    readonly query: TQuery;
    /**
     * The result of the query.
     */
    readonly result: TResult;
}
/**
 * This event is emitted when query processing completes with success. Both the query payload and the result are
 * included.
 *
 * @beta
 */
export interface IDashboardQueryCompleted<TQuery extends IDashboardQuery, TResult> extends IDashboardEvent {
    readonly type: "GDC.DASH/EVT.QUERY.COMPLETED";
    readonly payload: IDashboardQueryCompletedPayload<TQuery, TResult>;
}
export declare function queryCompleted<TQuery extends IDashboardQuery, TResult>(ctx: DashboardContext, query: TQuery, result: TResult, correlationId?: string): IDashboardQueryCompleted<TQuery, TResult>;
/**
 * Tests whether the provided object is an instance of {@link IDashboardQueryCompleted}.
 *
 * @param obj - object to test
 * @beta
 */
export declare const isDashboardQueryCompleted: (obj: unknown) => obj is IDashboardQueryCompleted<any, any>;
//# sourceMappingURL=general.d.ts.map