// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import "Command.idl";
import "ISettingsModelObject.idl";

namespace Microsoft.Terminal.Settings.Model
{
    static runtimeclass ActionArgFactory
    {
        static String GetNameForAction(Microsoft.Terminal.Settings.Model.ShortcutAction action);
        static String GetNameForAction(Microsoft.Terminal.Settings.Model.ShortcutAction action, Windows.ApplicationModel.Resources.Core.ResourceContext context);
        static Windows.Foundation.Collections.IMap<Microsoft.Terminal.Settings.Model.ShortcutAction, String> AvailableShortcutActionsAndNames { get; };
        static IActionArgs GetEmptyArgsForAction(Microsoft.Terminal.Settings.Model.ShortcutAction shortcutAction);
    }

    // This interface ensures that no changes are made to ActionMap
    interface IActionMapView
    {
        Boolean IsKeyChordExplicitlyUnbound(Microsoft.Terminal.Control.KeyChord keys);

        Command GetActionByKeyChord(Microsoft.Terminal.Control.KeyChord keys);
        Command GetActionByID(String cmdID);
        Microsoft.Terminal.Control.KeyChord GetKeyBindingForAction(String cmdID);
        IVector<Microsoft.Terminal.Control.KeyChord> AllKeyBindingsForAction(String cmdID);

        Windows.Foundation.Collections.IMapView<String, ActionAndArgs> AvailableActions { get; };

        Windows.Foundation.Collections.IMapView<String, Command> NameMap { get; };
        Windows.Foundation.Collections.IMapView<Microsoft.Terminal.Control.KeyChord, Command> KeyBindings { get; };
        Windows.Foundation.Collections.IMapView<Microsoft.Terminal.Control.KeyChord, Command> GlobalHotkeys { get; };
        Windows.Foundation.Collections.IVectorView<Command> AllCommands { get; };

        IVector<Command> ExpandedCommands { get; };

        Windows.Foundation.IAsyncOperation<IVector<Command> > FilterToSnippets(String CurrentCommandline, String CurrentWorkingDirectory);
    };

    runtimeclass ActionMap : IActionMapView
    {
        void AddAction(Command cmd, Microsoft.Terminal.Control.KeyChord keys);
        void RebindKeys(Microsoft.Terminal.Control.KeyChord oldKeys, Microsoft.Terminal.Control.KeyChord newKeys);
        void DeleteKeyBinding(Microsoft.Terminal.Control.KeyChord keys);
        void DeleteUserCommand(String cmdID);
        void AddKeyBinding(Microsoft.Terminal.Control.KeyChord keys, String cmdID);
        void RegisterKeyBinding(Microsoft.Terminal.Control.KeyChord keys, ActionAndArgs action);
        void AddSendInputAction(String name, String input, Microsoft.Terminal.Control.KeyChord keys);
    }
}
