/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Tools
 */
import { IModelApp } from "../IModelApp";
import { CoreTools } from "./Tool";
/** Tool Assistance known images
 * @public
 * @extensions
 */
export var ToolAssistanceImage;
(function (ToolAssistanceImage) {
    /** When Keyboard is specified, ToolAssistanceInstruction.keyboardInfo should be set. */
    ToolAssistanceImage[ToolAssistanceImage["Keyboard"] = 0] = "Keyboard";
    /** Plus sign */
    ToolAssistanceImage[ToolAssistanceImage["AcceptPoint"] = 1] = "AcceptPoint";
    /** Cursor image with click symbol */
    ToolAssistanceImage[ToolAssistanceImage["CursorClick"] = 2] = "CursorClick";
    /** Mouse image with darkened left button */
    ToolAssistanceImage[ToolAssistanceImage["LeftClick"] = 3] = "LeftClick";
    /** Mouse image with darkened right button */
    ToolAssistanceImage[ToolAssistanceImage["RightClick"] = 4] = "RightClick";
    /** Mouse image with darkened scroll wheel */
    ToolAssistanceImage[ToolAssistanceImage["MouseWheel"] = 5] = "MouseWheel";
    /** Mouse image with darkened left button and left/right arrows */
    ToolAssistanceImage[ToolAssistanceImage["LeftClickDrag"] = 6] = "LeftClickDrag";
    /** Mouse image with darkened right button and left/right arrows */
    ToolAssistanceImage[ToolAssistanceImage["RightClickDrag"] = 7] = "RightClickDrag";
    /** Mouse image with darkened scroll wheel and left/right arrows */
    ToolAssistanceImage[ToolAssistanceImage["MouseWheelClickDrag"] = 8] = "MouseWheelClickDrag";
    /** Touch image with single finger tapping once */
    ToolAssistanceImage[ToolAssistanceImage["OneTouchTap"] = 9] = "OneTouchTap";
    /** Touch image with single finger tapping twice */
    ToolAssistanceImage[ToolAssistanceImage["OneTouchDoubleTap"] = 10] = "OneTouchDoubleTap";
    /** Touch image with single finger dragging */
    ToolAssistanceImage[ToolAssistanceImage["OneTouchDrag"] = 11] = "OneTouchDrag";
    /** Touch image with two fingers tapping once */
    ToolAssistanceImage[ToolAssistanceImage["TwoTouchTap"] = 12] = "TwoTouchTap";
    /** Touch image with two fingers dragging */
    ToolAssistanceImage[ToolAssistanceImage["TwoTouchDrag"] = 13] = "TwoTouchDrag";
    /** Touch image with two fingers pinching */
    ToolAssistanceImage[ToolAssistanceImage["TwoTouchPinch"] = 14] = "TwoTouchPinch";
    /** Touch cursor image with single finger tapping once */
    ToolAssistanceImage[ToolAssistanceImage["TouchCursorTap"] = 15] = "TouchCursorTap";
    /** Touch cursor image with single finger dragging */
    ToolAssistanceImage[ToolAssistanceImage["TouchCursorDrag"] = 16] = "TouchCursorDrag";
})(ToolAssistanceImage || (ToolAssistanceImage = {}));
/** Input Method for Tool Assistance instruction
 * @public
 * @extensions
 */
export var ToolAssistanceInputMethod;
(function (ToolAssistanceInputMethod) {
    /** Instruction applies to both touch & mouse input methods */
    ToolAssistanceInputMethod[ToolAssistanceInputMethod["Both"] = 0] = "Both";
    /** Instruction applies to only mouse input method */
    ToolAssistanceInputMethod[ToolAssistanceInputMethod["Mouse"] = 1] = "Mouse";
    /** Instruction applies to only touch input method */
    ToolAssistanceInputMethod[ToolAssistanceInputMethod["Touch"] = 2] = "Touch";
})(ToolAssistanceInputMethod || (ToolAssistanceInputMethod = {}));
/** Tool Assistance helper methods.
 * @public
 * @extensions
 */
export class ToolAssistance {
    static translateKey(key) { return IModelApp.localization.getLocalizedString(`${CoreTools.namespace}:toolAssistance.${key}`); }
    static translateTouch(cursor) { return IModelApp.localization.getLocalizedString(`${CoreTools.namespace}:touchCursor.${cursor}`); }
    /** Return the translated string for the specified main instruction key */
    static translatePrompt(key) {
        return IModelApp.localization.getLocalizedString(`${CoreTools.tools}ElementSet.Prompts.${key}`);
    }
    /** Return the translated string for the specified input instruction key */
    static translateInput(key) {
        return IModelApp.localization.getLocalizedString(`${CoreTools.tools}ElementSet.Inputs.${key}`);
    }
    /** Alt key text. */
    static get altKey() {
        return this.translateKey("altKey");
    }
    /** Ctrl key text. */
    static get ctrlKey() {
        return this.translateKey("ctrlKey");
    }
    /** Shift key text. */
    static get shiftKey() {
        return this.translateKey("shiftKey");
    }
    /** Inputs text. */
    static get inputsLabel() {
        return this.translateKey("inputs");
    }
    /** Keyboard info for Alt key. */
    static get altKeyboardInfo() {
        return { keys: [ToolAssistance.altKey] };
    }
    /** Keyboard info for Ctrl key. */
    static get ctrlKeyboardInfo() {
        return { keys: [ToolAssistance.ctrlKey] };
    }
    /** Keyboard info for Shift key with symbol. */
    static get shiftKeyboardInfo() {
        return { keys: [`${ToolAssistance.shiftSymbol} ${ToolAssistance.shiftKey}`] };
    }
    /** Keyboard info for Shift key without symbol. */
    static get shiftKeyboardInfoNoSymbol() {
        return { keys: [ToolAssistance.shiftKey] };
    }
    /** Keyboard info for Shift key symbol. */
    static get shiftSymbolKeyboardInfo() {
        return { keys: [` ${ToolAssistance.shiftKey} `] };
    }
    /** Keyboard info for Ctrl key symbol. */
    static get ctrlSymbolKeyboardInfo() {
        return { keys: [ToolAssistance.ctrlSymbol] };
    }
    /** Keyboard info for Alt key symbol. */
    static get altSymbolKeyboardInfo() {
        return { keys: [ToolAssistance.altSymbol] };
    }
    /** Creates a [[ToolAssistanceInstruction]].
     */
    static createInstruction(image, text, isNew, inputMethod, keyboardInfo) {
        if (inputMethod === undefined)
            inputMethod = ToolAssistanceInputMethod.Both;
        const instruction = {
            image,
            text,
            keyboardInfo,
            isNew,
            inputMethod,
        };
        return instruction;
    }
    /** Creates a [[ToolAssistanceInstruction]] with a [[ToolAssistanceKeyboardInfo]].
     */
    static createKeyboardInstruction(keyboardInfo, text, isNew, inputMethod) {
        if (inputMethod === undefined)
            inputMethod = ToolAssistanceInputMethod.Mouse;
        const instruction = {
            image: ToolAssistanceImage.Keyboard,
            text,
            keyboardInfo,
            isNew,
            inputMethod,
        };
        return instruction;
    }
    /** Creates a [[ToolAssistanceInstruction]] with a modifier key and an image.
     */
    static createModifierKeyInstruction(modifierKey, image, text, isNew, inputMethod) {
        if (inputMethod === undefined)
            inputMethod = ToolAssistanceInputMethod.Both;
        const keyboardInfo = { keys: [modifierKey] };
        const instruction = {
            image,
            text,
            keyboardInfo,
            isNew,
            inputMethod,
        };
        return instruction;
    }
    /** Creates a [[ToolAssistanceKeyboardInfo]].
     */
    static createKeyboardInfo(keys, bottomKeys) {
        const keyboardInfo = {
            keys,
            bottomKeys,
        };
        return keyboardInfo;
    }
    /** Creates instructions for interaction with the touch cursor that are appended to the supplied [[ToolAssistanceInstruction]] array.
     */
    static createTouchCursorInstructions(instructions) {
        const accuSnap = IModelApp.accuSnap;
        if (undefined === accuSnap.touchCursor && accuSnap.wantVirtualCursor) {
            instructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.OneTouchTap, this.translateTouch("Activate"), false, ToolAssistanceInputMethod.Touch));
            return true;
        }
        else if (undefined !== accuSnap.touchCursor) {
            instructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.TouchCursorDrag, this.translateTouch("IdentifyPoint"), false, ToolAssistanceInputMethod.Touch));
            instructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.TouchCursorTap, this.translateTouch("AcceptPoint"), false, ToolAssistanceInputMethod.Touch));
            return true;
        }
        return false;
    }
    /** Creates a [[ToolAssistanceSection]].
     */
    static createSection(instructions, label) {
        const section = {
            instructions,
            label,
        };
        return section;
    }
    /** Creates a [[ToolAssistanceInstructions]].
     */
    static createInstructions(mainInstruction, sections) {
        const instructions = {
            mainInstruction,
            sections,
        };
        return instructions;
    }
}
/** Up key symbol. */
ToolAssistance.upSymbol = "\u2bc5";
/** Down key symbol. */
ToolAssistance.downSymbol = "\u2bc6";
/** Left key symbol. */
ToolAssistance.leftSymbol = "\u2bc7";
/** Right key symbol. */
ToolAssistance.rightSymbol = "\u2bc8";
/** Keyboard info for Arrow keys. */
ToolAssistance.arrowKeyboardInfo = {
    keys: [ToolAssistance.upSymbol],
    bottomKeys: [ToolAssistance.leftSymbol, ToolAssistance.downSymbol, ToolAssistance.rightSymbol],
};
/** Shift key symbol. */
ToolAssistance.shiftSymbol = "\u21e7";
/** Ctrl key symbol. */
ToolAssistance.ctrlSymbol = "\u2038";
/** Alt key symbol. */
ToolAssistance.altSymbol = "\u2387";
//# sourceMappingURL=ToolAssistance.js.map