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

import "GlobalAppSettings.idl";
import "Profile.idl";
import "TerminalWarnings.idl";
import "DefaultTerminal.idl";

namespace Microsoft.Terminal.Settings.Model
{
    enum FragmentScope
    {
        User,
        Machine
    };

    runtimeclass CascadiaSettings {
        static CascadiaSettings LoadDefaults();
        static CascadiaSettings LoadAll();

        static String SettingsDirectory { get; };
        static String SettingsPath { get; };
        static String DefaultSettingsPath { get; };
        static Boolean IsPortableMode { get; };

        static String ApplicationDisplayName { get; };
        static String ApplicationVersion { get; };

        CascadiaSettings(String userJSON, String inboxJSON);

        CascadiaSettings Copy();
        void ResetApplicationState();
        void ResetToDefaultSettings();
        Boolean WriteSettingsToDisk();
        void LogSettingChanges(Boolean isJsonLoad);

        String Hash { get; };

        GlobalAppSettings GlobalSettings { get; };

        Profile ProfileDefaults { get; };

        IObservableVector<Profile> AllProfiles { get; };
        IObservableVector<Profile> ActiveProfiles { get; };

        Profile DuplicateProfile(Profile sourceProfile);

        ActionMap ActionMap { get; };
        Windows.Foundation.Collections.IVectorView<ExtensionPackage> Extensions { get; };

        IVectorView<SettingsLoadWarnings> Warnings { get; };
        Windows.Foundation.IReference<SettingsLoadErrors> GetLoadingError { get; };
        String GetSerializationErrorMessage { get; };

        Profile CreateNewProfile();
        Profile FindProfile(Guid profileGuid);
        void UpdateColorSchemeReferences(String oldName, String newName);

        Profile GetProfileForArgs(NewTerminalArgs newTerminalArgs);

        static Boolean IsDefaultTerminalAvailable { get; };
        static Boolean IsDefaultTerminalSet { get; };
        IObservableVector<DefaultTerminal> DefaultTerminals { get; };
        DefaultTerminal CurrentDefaultTerminal;

        void ExpandCommands();
        void UpdateCommandID(Command cmd, String newID);

        void ResolveMediaResources();
    }

    runtimeclass FragmentProfileEntry
    {
        Guid ProfileGuid { get; };
        String Json { get; };
    }

    runtimeclass FragmentColorSchemeEntry
    {
        String ColorSchemeName { get; };
        String Json { get; };
    }

    runtimeclass FragmentSettings
    {
        String Source { get; };
        String Json { get; };
        String Filename { get; };
        IVectorView<FragmentProfileEntry> ModifiedProfilesView { get; };
        IVectorView<FragmentProfileEntry> NewProfilesView { get; };
        IVectorView<FragmentColorSchemeEntry> ColorSchemesView { get; };
    }

    runtimeclass ExtensionPackage
    {
        String Source { get; };
        String DisplayName { get; };
        String Icon { get; };
        FragmentScope Scope { get; };
        IVectorView<FragmentSettings> FragmentsView { get; };
    }
}
