/// <reference path="./sigApi.ApiBase.d.ts" />

declare namespace SigApi {
    interface ApiDragAndDrop extends ApiBase {
        /**
         * Returns a NodeList of all droppable components, i.e. components which have the property "isdroppable" set on True.
         * @returns {NodeList} A NodeList object containing domRef of all droppable components.
         */
        getAllDroppables(): NodeList
        /**
         * Returns a NodeList of all draggable components, i.e. components which have the property "isdraggable" set on True.
         * @returns {NodeList} A NodeList object containing domRef of all draggable components.
         */
        getAllDraggables(): NodeList
        /**
         * Returns the current state of the Drag & Drop mode.
         * @returns {boolean} True if Drag & Drop mode is activated, otherwise False.
         */
        isDragMode(): boolean
        /**
         * Returns a component currently being dragged. 
         * @returns {Node|null} The domRef of the component currently being dragged or Null if no component is being dragged.
         */
        getDraggedComponent(): Node | null
        /**
         * Activates the Drag & Drop mode by sending the DRAG_DROP_ENABLED event locally.
         */
        enableDragMode(): void
        /**
         * Deactivates the Drag & Drop mode by sending the DRAG_DROP_DISABLED event locally.
         */
        disableDragMode(): void
        /**
         * Adds the necessary event handlers to the specified component making it draggable.
         * @param {string|Node} id The instance ID or the domRef of the component which property "isdraggable" should be set on True.
         * @returns {boolean} True, if "isdraggable" successfully set on True. False, if the given id is not a valid HTMLElement.
         */
        addDragSupport(id: string | Node): boolean
        /**
         * Adds the necessary event handlers to the specified component making it droppable.
         * @param {string|Node} id The instance ID or the domRef of the component which property "isdroppable" should be set on True.
         * @returns {boolean} True, if "isdroppable" successfully set on True. False, if the given id is not a valid HTMLElement.
         */
        addDropSupport(id: string | Node): boolean
        /**
         * Removes the bound event handlers from the component making it no longer draggable.
         * @param {string|node} id The instance ID or domRef of the component which property "isdraggable" should be set on False.
         * @returns {boolean} True, if "isdraggable" successfully set on False. False, if the given id is not a valid HTMLElement.
         */
        removeDragSupport(id: string | Node): boolean
        /**
         * Removes the bound event handlers of the component making it no longer droppable.
         * @param {string|Node} id The instance ID or domRef of the component which property "isdroppable" should be set on False.
         * @returns {boolean} True, if "isdroppable" successfully set on False. False, if the given id is not a valid HTMLElement.
         */
        removeDropSupport(id: string | Node): boolean
        /**
         * Sets a custom Node as the drag preview image for the specified draggable component. 
         * @param {string|Node} id The instance ID or domRef of the component which drag preview image should be changed.
         * @param {Node} node The domref of the Node which should be used as the drag preview image while dragging the component denoted by id.
         * @returns {boolean|null} True, if the property previewNode successfully set. False, if the given node is not a valid HTMLElement. Null, if the given id is not a valid HTMLElement.
         */
        setDragPreviewNode(id: string | Node, node: Node): boolean | null
        /**
         * Returns the custom Node used as the drag preview image of the specified draggable component. 
         * @param {string|Node} id The instance ID or domRef of the component which drag preview image should be returned.
         * @returns {Node|null}  The domref of the Node which is used as the custom drag preview image. Null, if no custom Node has been defined.
         */
        getDragPreviewNode(id: string | Node): Node | null
        /**
         * Removes the custom Node used as the drag preview image from the specified draggable component. 
         * @param {string|Node} id The instance ID or domRef of the component which drag preview image should be removed.
         * @param {boolean} removeFromDom A flag which controls whether the Node should also be removed from the DOM tree or not.
         * @returns {boolean} True, if the property previewNode successfully set on Null and possibly removed from DOM. False, if the given id is not a valid HTMLElement.
         */
        removeDragPreviewNode(id: string | Node, removeFromDom: boolean): boolean
        /**
         * Returns the custom Node used as the drag preview image of the component currently being dragged.
         * @returns {Node|null} The domref of the Node which is used as the custom drag preview image. Null, if no custom Node has been defined.
         */
        getCurrentPreviewNode(): Node | null
        /**
         * Sets a custom dragged opacity value for the drag clone.
         * @param {string|Node} id The instance ID or domRef of the component.
         * @param {number} opacity A number from 0.0 to 1.0.
         * @returns {boolean|null} True, if the opacity was successfully set. False, if the specified opacity is not Number or out of range. 
         * Null, if the specified component id was not found.
         */
        setDraggedOpacity(id: string | Node, opacity: number): boolean | null
        /**
         * Gets the currently set custom dragged opacity value.
         * @param {string|Node} id The instance ID or domRef of the component.
         * @returns {number|undefined|null} Number from 0.0 to 1.0, if custom opacity is set. Undefined, if no custom opacity is set.
         * Null, if the specified component ID was not found.
         */
        getDraggedOpacity(id: string | Node): number | null | undefined
        /**
         * Resets the currently set custom dragged opacity value on undefined.
         * @param {string|Node} id The instance ID or domRef of the component.
         * @returns {undefined|null} Undefined, denoting operation success. Null, if the specified component ID was not found.
         */
        resetDraggedOpacity(id: string | Node): null | undefined
        /** 
         * Adds the long press support to the component with the given ID.
         * @param {string|Node} id The instance ID or domRef of the component.
         * @param {number} [delay=1000] The long press delay in milliseconds.
         * @returns {boolean|null} Returns true, if long press support was added or false on error. Null, if the specified component id was not found.
         */
        addLongpressSupport(id: string | Node, delay?: number): boolean | null
        /** 
         * Removes the long press support from the component with the given ID.
         * @param {string|Node} id The instance ID or domRef of the component.
         * @returns {boolean|null} Returns true, if long press support was removed or false on error. Null, if the specified component id was not found.
         */
        removeLongpressSupport(id: string | Node): boolean | null
        /**
         * Inverts the order in which the drop targets are handled. (Default is from the top to the bottom target)
         * @param {boolean} reverse If true, the handling of the drop targets is reversed.
         * @returns {boolean} Returns true, if update of the processing sequence was successful, otherwise false.
         */
        setReverseDropTargetsOrder(reverse: boolean): boolean
        /**
         * Returns true|false based on whether the handling of the drop targets is reversed.
         * @returns {boolean} Returns true, if the handling of the drop targets is reversed.
         */
        getReverseDropTargetsOrder(): boolean
        /**
         * Returns the DOM reference of the actively handled Drop Target or NULL.
         * @returns {Node|null} The DOM reference of the actively handled Drop Target or NULL.
         */
        getActiveDropTarget(): Node | null
        /**
         * Returns an array of the found drop targets in the current position or NULL.
         * @returns {HTMLElement[] | null} A array of the found drop targets in the current position or NULL.
         */
        getActiveDropTargets(): HTMLElement[] | null
        /**
         * Adds single InstanceId given as String or Array of InstanceIds in the "Handled" list of Drop Targets.
         * @param {string|string[]} targets The InstanceId(s) of droppable targets that are supposed to be handled.
         * @returns {boolean} True if the drop targets were successfully set, otherwise false.
         */
        setHandledDropTargets(targets: string | string[]): boolean
        /**
         * Returns an array of the instance IDs of the actively handled drop targets.
         * @returns {string[]} An array of the instance IDs of the actively handled drop targets.
         */
        getHandledDropTargets(): string[]
        /**
         * Removes drop targets from the actively handled drop targets list.
         * @param {string|string[]} targets The droppable targets that are to be removed from the list.
         * @returns {boolean} True if the drop targets were successfully removed.
         */
        removeHandledDropTargets(targets: string | string[]): boolean
        /**
         * Empties the list of the actively handled drop targets.
         * @returns {boolean} True, if the array was cleared.
         */
        clearHandledDropTargets(): boolean
        /**
         * Adds single InstanceId given as String or Array of InstanceIds in the "Ignored" list of Drop Targets.
         * A target will be ignored if it is in the "Handled" as well as in the "Ignored" list of Drop Targets.
         * @param {string|string[]} targets The InstanceId(s) of droppable targets that are supposed to be ignored.
         * @returns {boolean} True if the drop targets were successfully set, otherwise false.
         */
        setIgnoredDropTargets(targets: string | string[]): boolean
        /**
         * Returns an array of ignored drop targets.
         * @returns {string[]} An array containing the ignored drop targets.
         */
        getIgnoredDropTargets(): string[]
        /**
         * Removes drop targets from the ignored drop targets list.
         * @param {string|string[]} targets An array of instance IDs that are to be removed from the list of ignored drop targets.
         * @returns {boolean} True if the drop targets were successfully removed from the ignored drop targets list.
         */
        removeIgnoredDropTargets(targets: string | string[]): boolean
        /**
         * Empties the list of the ignored drop targets.
         * @returns {boolean} True, if the list was cleared.
         */
        clearIgnoredDropTargets(): boolean
        /**
         * Returns true|false based on whether the target is in the list of actively handled drop targets.
         * @param {string} target The instance ID of the target to be checked.
         * @returns {boolean} True, if the drop target is handled, false if not.
         */
        isHandledDropTarget(target: string): boolean
        /**
         * Returns true|false based on whether the target is in the list of the ignored drop targets.
         * @param {string} target The instance ID of the target to be checked.
         * @returns {boolean} True, if the drop target is ignored, false if not.
         */
        isIgnoredDropTarget(target: string): boolean
        /**
         * Returns true|false based on whether the target is a valid drop target.
         * @param {string} target The instance ID of the target to be checked.
         * @returns {boolean} True, if the drop target is valid, false if not.
         */
        isValidDropTarget(target: string): boolean
    }
}
