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

import "EnumEntry.idl";
import "MainPage.idl";
import "ProfileViewModel.idl";
import "ColorSchemeViewModel.idl";
import "ColorSchemesPageViewModel.idl";

#include "ViewModelHelpers.idl.h"

#define OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Type, Name) \
    OBSERVABLE_PROJECTED_SETTING(Type, Name);               \
    Object Name##OverrideSource { get; }

#define COMMA ,

namespace Microsoft.Terminal.Settings.Editor
{
    runtimeclass Font
    {
        String Name { get; };
        String LocalizedName { get; };
    }

    runtimeclass FontKeyValuePair
    {
        UInt32 Key { get; };
        String KeyDisplayString { get; };
        Single Value;
        String AutomationName { get; };
    }

    runtimeclass AppearanceViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        Boolean IsDefault;

        void SetFontWeightFromDouble(Double fontWeight);
        void SetBackgroundImageOpacityFromPercentageValue(Double percentageValue);
        void SetBackgroundImagePath(String path);

        String CurrentBackgroundImagePath { get; };
        Boolean UseDesktopBGImage;
        Boolean BackgroundImageSettingsVisible { get; };
        String BackgroundImageAlignmentCurrentValue { get; };

        void ClearColorScheme();
        ColorSchemeViewModel CurrentColorScheme;
        IObservableVector<ColorSchemeViewModel> SchemesList;

        Windows.UI.Color ForegroundPreview { get; };
        Windows.UI.Color BackgroundPreview { get; };
        Windows.UI.Color SelectionBackgroundPreview { get; };
        Windows.UI.Color CursorColorPreview { get; };

        String MissingFontFaces { get; };
        String ProportionalFontFaces { get; };
        Boolean HasPowerlineCharacters { get; };

        IObservableVector<FontKeyValuePair> FontAxes { get; };
        Boolean HasFontAxes { get; };
        void ClearFontAxes();
        Object FontAxesOverrideSource { get; };

        IObservableVector<FontKeyValuePair> FontFeatures { get; };
        Boolean HasFontFeatures { get; };
        void ClearFontFeatures();
        Object FontFeaturesOverrideSource { get; };

        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(String, FontFace);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Single, FontSize);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Double, LineHeight);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Double, CellWidth);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.UI.Text.FontWeight, FontWeight);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Boolean, EnableBuiltinGlyphs);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Boolean, EnableColorGlyphs);

        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(String, DarkColorSchemeName);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(String, LightColorSchemeName);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Boolean, RetroTerminalEffect);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Core.CursorStyle, CursorShape);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(UInt32, CursorHeight);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Settings.Model.IMediaResource, BackgroundImagePath);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Single, BackgroundImageOpacity);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.UI.Xaml.Media.Stretch, BackgroundImageStretchMode);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Settings.Model.ConvergedAlignment, BackgroundImageAlignment);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Settings.Model.IntenseStyle, IntenseTextStyle);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Microsoft.Terminal.Core.AdjustTextMode, AdjustIndistinguishableColors);

        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>, Foreground);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>, Background);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>, SelectionBackground);
        OBSERVABLE_PROJECTED_APPEARANCE_SETTING(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>, CursorColor);
    }

    [default_interface] runtimeclass Appearances : Windows.UI.Xaml.Controls.UserControl, Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        Appearances();
        AppearanceViewModel Appearance;
        ProfileViewModel SourceProfile;
        IHostedInWindow WindowRoot;
        static Windows.UI.Xaml.DependencyProperty AppearanceProperty { get; };

        IObservableVector<Font> FilteredFontList { get; };
        Boolean ShowAllFonts;

        IInspectable CurrentCursorShape;
        Boolean IsVintageCursor { get; };
        IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> CursorShapeList { get; };

        IInspectable CurrentAdjustIndistinguishableColors;
        IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> AdjustIndistinguishableColorsList { get; };

        IInspectable CurrentBackgroundImageStretchMode;
        IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> BackgroundImageStretchModeList { get; };

        IInspectable CurrentFontWeight;
        Boolean IsCustomFontWeight { get; };
        IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> FontWeightList { get; };

        IInspectable CurrentIntenseTextStyle;
        IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> IntenseTextStyleList { get; };
    }
}
