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

#include "IInheritable.idl.h"

import "Theme.idl";
import "ColorScheme.idl";
import "ActionMap.idl";
import "NewTabMenuEntry.idl";

namespace Microsoft.Terminal.Settings.Model
{
    // MIDL 3 allows for structs to hold nullable types
    // Though IReference is a WinRT object, MIDL 3
    // handles all of the ownership logic for us.
    // Docs: https://docs.microsoft.com/en-us/uwp/midl-3/intro#types
    struct LaunchPosition
    {
        Windows.Foundation.IReference<Int32> X;
        Windows.Foundation.IReference<Int32> Y;
    };

    [flags]
    enum LaunchMode
    {
        DefaultMode = 0,
        MaximizedMode = 1,
        FullscreenMode = 2,
        FocusMode = 4,
        MaximizedFocusMode = 5
    };

    enum WindowingMode
    {
        UseNew,
        UseAnyExisting,
        UseExisting,
    };

    enum FirstWindowPreference
    {
        DefaultProfile,
        PersistedLayout,
        PersistedLayoutAndContent,
    };

    enum NewTabPosition
    {
        AfterLastTab,
        AfterCurrentTab,
    };

    [default_interface] runtimeclass GlobalAppSettings {
        Guid DefaultProfile;

        INHERITABLE_SETTING(String, UnparsedDefaultProfile);

        INHERITABLE_SETTING(Int32, InitialRows);
        INHERITABLE_SETTING(Int32, InitialCols);
        INHERITABLE_SETTING(Boolean, AlwaysShowTabs);
        INHERITABLE_SETTING(Boolean, ShowTabsFullscreen);
        INHERITABLE_SETTING(NewTabPosition, NewTabPosition);
        INHERITABLE_SETTING(Boolean, ShowTitleInTitlebar);
        INHERITABLE_SETTING(Boolean, ConfirmCloseAllTabs);
        INHERITABLE_SETTING(String, Language);
        INHERITABLE_SETTING(Microsoft.UI.Xaml.Controls.TabViewWidthMode, TabWidthMode);
        INHERITABLE_SETTING(Boolean, UseAcrylicInTabRow);
        INHERITABLE_SETTING(Boolean, ShowTabsInTitlebar);
        INHERITABLE_SETTING(String, WordDelimiters);
        INHERITABLE_SETTING(Boolean, CopyOnSelect);
        INHERITABLE_SETTING(Boolean, InputServiceWarning);
        INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
        INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
        INHERITABLE_SETTING(Microsoft.Terminal.Control.WarnAboutMultiLinePaste, WarnAboutMultiLinePaste);
        INHERITABLE_SETTING(Boolean, TrimPaste);
        INHERITABLE_SETTING(LaunchPosition, InitialPosition);
        INHERITABLE_SETTING(Boolean, CenterOnLaunch);
        INHERITABLE_SETTING(Microsoft.Terminal.Control.DefaultInputScope, DefaultInputScope);
        INHERITABLE_SETTING(FirstWindowPreference, FirstWindowPreference);
        INHERITABLE_SETTING(LaunchMode, LaunchMode);
        INHERITABLE_SETTING(Boolean, SnapToGridOnResize);
        INHERITABLE_SETTING(Microsoft.Terminal.Control.GraphicsAPI, GraphicsAPI);
        INHERITABLE_SETTING(Boolean, DisablePartialInvalidation);
        INHERITABLE_SETTING(Boolean, SoftwareRendering);
        INHERITABLE_SETTING(Microsoft.Terminal.Control.TextMeasurement, TextMeasurement);
        INHERITABLE_SETTING(Boolean, UseBackgroundImageForWindow);
        INHERITABLE_SETTING(Boolean, DebugFeaturesEnabled);
        INHERITABLE_SETTING(Boolean, AlwaysOnTop);
        INHERITABLE_SETTING(Boolean, AutoHideWindow);
        INHERITABLE_SETTING(TabSwitcherMode, TabSwitcherMode);
        INHERITABLE_SETTING(Boolean, DisableAnimations);
        INHERITABLE_SETTING(String, StartupActions);
        INHERITABLE_SETTING(Boolean, FocusFollowMouse);
        INHERITABLE_SETTING(Boolean, ScrollToZoom);
        INHERITABLE_SETTING(Boolean, ScrollToChangeOpacity);
        INHERITABLE_SETTING(WindowingMode, WindowingBehavior);
        INHERITABLE_SETTING(Boolean, TrimBlockSelection);
        INHERITABLE_SETTING(Boolean, DetectURLs);
        INHERITABLE_SETTING(Boolean, MinimizeToNotificationArea);
        INHERITABLE_SETTING(Boolean, AlwaysShowNotificationIcon);
        INHERITABLE_SETTING(IVector<String>, DisabledProfileSources);
        INHERITABLE_SETTING(Boolean, ShowAdminShield);
        INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
        INHERITABLE_SETTING(Boolean, EnableColorSelection);
        INHERITABLE_SETTING(Boolean, EnableShellCompletionMenu);
        INHERITABLE_SETTING(Boolean, EnableUnfocusedAcrylic);
        INHERITABLE_SETTING(Boolean, AllowHeadless);
        INHERITABLE_SETTING(String, SearchWebDefaultQueryUrl);

        Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
        void AddColorScheme(ColorScheme scheme);
        void RemoveColorScheme(String schemeName);
        ColorScheme DuplicateColorScheme(ColorScheme scheme);

        ActionMap ActionMap { get; };

        Windows.Foundation.Collections.IMapView<String, Theme> Themes();
        void AddTheme(Theme theme);
        INHERITABLE_SETTING(ThemePair, Theme);
        Theme CurrentTheme { get; };

        Boolean ShouldUsePersistedLayout();
    }
}
