using ZB.MOM.WW.OtOpcUa.Client.UI.Services;

namespace ZB.MOM.WW.OtOpcUa.Client.UI.Tests.Fakes;

public sealed class FakeSettingsService : ISettingsService
{
    /// <summary>Gets or sets the settings held by this fake service.</summary>
    public UserSettings Settings { get; set; } = new();
    /// <summary>Gets the number of times Load has been called.</summary>
    public int LoadCallCount { get; private set; }
    /// <summary>Gets the number of times Save has been called.</summary>
    public int SaveCallCount { get; private set; }
    /// <summary>Gets the last settings that were saved.</summary>
    public UserSettings? LastSaved { get; private set; }

    /// <summary>Loads and returns the current settings.</summary>
    public UserSettings Load()
    {
        LoadCallCount++;
        return Settings;
    }

    /// <summary>Saves the specified settings.</summary>
    /// <param name="settings">The settings to save.</param>
    public void Save(UserSettings settings)
    {
        SaveCallCount++;
        LastSaved = settings;
    }
}
