using Metin2Launcher.Manifest;

namespace Metin2Launcher.Formats;

/// <summary>
/// The original release format: the manifest's <c>files</c> array lists
/// individual files (exe, dlls, packs, locale/&lt;pre-m2pack&gt;) that the
/// launcher downloads by sha256 and atomically replaces inside the client
/// root. Preserved unchanged so an install that still points at an old
/// manifest endpoint works identically.
/// </summary>
public sealed class LegacyJsonBlobFormat : IReleaseFormat
{
    public const string FormatName = "legacy-json-blob";

    public string Name => FormatName;

    public IReadOnlyList<ManifestFile> FilterApplicable(Manifest.Manifest manifest, string platform)
    {
        return manifest.Files.Where(f => f.AppliesTo(platform)).ToList();
    }

    public void OnApplied(string clientRoot, LoadedManifest manifest, ReleaseOutcome outcome)
    {
        // Nothing format-specific happens after apply for the legacy flow.
    }
}
