/**
 * Created by rburson on 2/10/16.
 */
import * as React from 'react';
import { CvState, CvProps, CvContext, CvEvent, CvEventRegistry, CvNavigationResult, CvActionFiredResult, CvValueProvider, CvResultCallback, CvStateChangeResult, CvValueListener } from './catreact-core';
import { PaneContext, MenuDef } from 'catavolt-sdk';
export interface CvActionBaseProps extends CvProps {
    /**
     * The actionId of this action
     */
    actionId?: string;
    /**
     * Array of {@link CvListener}s that will be notified of any actions fired
     */
    actionListeners?: Array<(event: CvEvent<CvActionFiredResult>) => void>;
    /**
     * If this callback function is provided, automatically fire this action immediately upon mounting and
     * return the result via the callback
     */
    fireOnLoad?: CvResultCallback<CvNavigationResult>;
    /**
     * The sdk {MenuDef} that points to this action. If not specified the containing sdk {PaneContext} will
     * be searched for the matching MenuDef
     */
    menuDef?: MenuDef;
    /**
     * Register to receive {@link CvEvent}s of type {@link CvNavigationResult}
     */
    navigationListeners?: Array<(event: CvEvent<CvNavigationResult>) => void>;
    /**
     * Provide a target for any navigations that originate from this action.  The navTarget should
     * correspond to the 'targetId' value of the coresident {@link CvNavigation} or {@link CvNavigator}.
     * This is useful for single page apps where components may be coresident.
     */
    navTarget?: string;
    /**
     * The sdk {PaneContext} associated with this action.  If not specified, the context chain will be upwardly
     * searched to find a component with a containing sdk {PaneContext} scopeObj
     */
    paneContext?: PaneContext;
    /**
     * Provides any target values that may have been 'selected' when firing this action
     */
    selectionProvider?: CvValueProvider<Array<string>>;
    /**
     * Render override function.  It should accept the following params:
     * @param cvContext The current cvContext.  The cvContext.cvScope.scopeObj will be the sdk {MenuDef} object
     * @param callback A callback for firing the action
     */
    renderer?: (cvContext: CvContext, callback?: CvActionCallback) => {};
    /**
     * Name of the wrapping element (should be component name)
     * Defaults to 'span' from backward compatibility's sake
     */
    wrapperElemName?: string;
    /**
     * Props for the wrapping element
     */
    wrapperElemProps?: any;
    /**
     * Name of the wrapperElem property that fires the action (i.e. onClick or onPress)
     * Defaults to 'onClick'
     */
    wrapperEventHandlerName?: string;
    /**
     * Register to receive {@link CvEvent}s of type {@link CvStateChangeResult}
     */
    stateChangeListeners?: Array<(event: CvEvent<CvStateChangeResult>) => void>;
    /**
     * Allows the specification of a handler for 'client' side actions.  This is a special class of actions
     * that require some type of special processing by the client. (i.e. #search, #refresh, #calulateStatistics, etc.)
     */
    actionHandler?: CvValueListener<CvActionHandlerParams>;
}
export interface CvActionBaseState extends CvState {
    selectedTargets: Array<string>;
}
export interface CvActionHandlerParams {
    event: CvEvent<CvActionFiredResult>;
    callback: CvResultCallback<any>;
}
export interface CvActionCallback {
    fireAction(resultCallback?: CvResultCallback<CvNavigationResult>): void;
}
export declare var CvActionBase: {
    findPaneContextWithActionId: (actionId: string) => PaneContext;
    getSelectedTargets: () => any;
    paneContext: () => any;
    menuDef: () => any;
    performAction: (resultCallback?: CvResultCallback<CvNavigationResult>, presaveExecuted?: boolean, destroyRequested?: boolean) => void;
    _checkDestroyed: (paneContext: PaneContext) => void;
    _componentDidMount: () => void;
    _componentWillReceiveProps: (nextProps: any) => void;
    _shouldComponentUpdate: (nextProps: any, nextState: any) => boolean;
    _getCallbackObj: () => CvActionCallback;
    _getInitialState: () => {
        selectedTargets: any[];
    };
    _setSelection(selectedTargets: string[]): void;
    _getActionMeta: (actionId: string) => {
        isClientAction: any;
        noTransition: any;
    };
    _publishActionStarted: (actionId: string, source: PaneContext, clientAction: boolean, actionListeners: ((event: CvEvent<CvActionFiredResult>) => void)[], eventRegistry: CvEventRegistry) => CvEvent<CvActionFiredResult>;
    _publishActionFinished: (actionId: string, source: PaneContext, actionListeners: ((event: CvEvent<CvActionFiredResult>) => void)[], eventRegistry: CvEventRegistry) => CvEvent<CvActionFiredResult>;
};
export interface CvActionState extends CvActionBaseState {
}
export interface CvActionProps extends CvActionBaseProps {
}
export declare var CvAction: React.ClassicComponentClass<CvActionProps>;
