// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "TaskbarState.idl";
import "Remoting.idl";

namespace TerminalApp
{
    [default_interface] runtimeclass ContentManager
    {
        Microsoft.Terminal.Control.ControlInteractivity CreateCore(Microsoft.Terminal.Control.IControlSettings settings,
                                                                   Microsoft.Terminal.Control.IControlAppearance unfocusedAppearance,
                                                                   Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);

        Microsoft.Terminal.Control.ControlInteractivity TryLookupCore(UInt64 id);
        void Detach(Microsoft.Terminal.Control.TermControl control);
    }

    [default_interface] runtimeclass RenameWindowRequestedArgs
    {
        String ProposedName { get; };
    };
    [default_interface] runtimeclass RequestMoveContentArgs
    {
        String Window { get; };
        String Content { get; };
        UInt32 TabIndex { get; };
        Windows.Foundation.IReference<Windows.Foundation.Point> WindowPosition { get; };
    };

    interface IDialogPresenter
    {
        Windows.Foundation.IAsyncOperation<Windows.UI.Xaml.Controls.ContentDialogResult> ShowDialog(Windows.UI.Xaml.Controls.ContentDialog dialog);
    };

    [default_interface] runtimeclass WindowProperties : Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        String WindowName { get; };
        UInt64 WindowId { get; };
        String WindowNameForDisplay { get; };
        String WindowIdForDisplay { get; };

        String VirtualWorkingDirectory { get; set; };
        String VirtualEnvVars { get; set; };

        Boolean IsQuakeWindow();
    };

    runtimeclass LaunchPositionRequest
    {
        Microsoft.Terminal.Settings.Model.LaunchPosition Position;
    }

    [default_interface] runtimeclass TerminalPage : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged, Microsoft.Terminal.UI.IDirectKeyListener
    {
        TerminalPage(WindowProperties properties, ContentManager manager);

        // XAML bound properties
        String ApplicationDisplayName { get; };
        String ApplicationVersion { get; };

        Boolean FocusMode { get; };
        Boolean Fullscreen { get; };
        Boolean AlwaysOnTop { get; };

        WindowProperties WindowProperties { get; };
        void IdentifyWindow();

        String SavedActionName { get; };
        String SavedActionKeyChord { get; };
        String SavedActionCommandLine { get; };

        // We cannot use the default XAML APIs because we want to make sure
        // that there's only one application-global dialog visible at a time,
        // and because of GH#5224.
        IDialogPresenter DialogPresenter;
        void ShowKeyboardServiceWarning();
        String KeyboardServiceDisabledText { get; };

        TaskbarState TaskbarState{ get; };

        Windows.UI.Xaml.Media.Brush TitlebarBrush { get; };
        void WindowActivated(Boolean activated);
        void SendContentToOther(RequestReceiveContentArgs args);

        event Windows.Foundation.TypedEventHandler<Object, Object> TitleChanged;
        event Windows.Foundation.TypedEventHandler<Object, Object> CloseWindowRequested;
        event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.UIElement> SetTitleBarContent;
        event Windows.Foundation.TypedEventHandler<Object, Object> FocusModeChanged;
        event Windows.Foundation.TypedEventHandler<Object, Object> FullscreenChanged;
        event Windows.Foundation.TypedEventHandler<Object, Object> AlwaysOnTopChanged;
        event Windows.Foundation.TypedEventHandler<Object, Object> Initialized;
        event Windows.Foundation.TypedEventHandler<Object, Object> SetTaskbarProgress;
        event Windows.Foundation.TypedEventHandler<Object, Object> IdentifyWindowsRequested;
        event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
        event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
        event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.WindowSizeChangedEventArgs> WindowSizeChanged;

        event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
        event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;
        event Windows.Foundation.TypedEventHandler<Object, Windows.Foundation.Collections.IVectorView<Microsoft.Terminal.Settings.Model.SettingsLoadWarnings> > ShowLoadWarningsDialog;

        event Windows.Foundation.TypedEventHandler<Object, RequestMoveContentArgs> RequestMoveContent;
        event Windows.Foundation.TypedEventHandler<Object, RequestReceiveContentArgs> RequestReceiveContent;

        event Windows.Foundation.TypedEventHandler<Object, LaunchPositionRequest> RequestLaunchPosition;
    }
}
