// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization.Metadata; namespace Microsoft.CmdPal.UI.ViewModels.Services; /// /// Provides AOT-compatible JSON file persistence with shallow-merge strategy. /// public interface IPersistenceService { /// /// Loads and deserializes a model from the specified JSON file. /// Returns a new instance when the file is missing or unreadable. /// T Load(string filePath, JsonTypeInfo typeInfo) where T : new(); /// /// Serializes , shallow-merges into the existing file /// (preserving unknown keys), and writes the result back to disk. /// /// The model to persist. /// Target JSON file path. /// AOT-compatible type metadata. void Save(T model, string filePath, JsonTypeInfo typeInfo); }