/*
+------------------------------------------------------------------+
| Author: Ivan Murzak (https://github.com/IvanMurzak) |
| Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) |
| Copyright (c) 2025 Ivan Murzak |
| Licensed under the Apache License, Version 2.0. |
| See the LICENSE file in the project root for more information. |
+------------------------------------------------------------------+
*/
#nullable enable
namespace com.IvanMurzak.Unity.MCP.Editor.DependencyResolver
{
///
/// Represents a NuGet package dependency with its ID and version.
///
readonly struct NuGetPackage
{
/// NuGet package ID (e.g., "System.Text.Json").
public readonly string Id;
/// Package version (e.g., "10.0.3").
public readonly string Version;
///
/// If true, this DLL is included in game builds (all platforms).
/// If false, the DLL is editor-only (excluded from builds via PluginImporter).
///
public readonly bool IncludeInBuild;
public NuGetPackage(string id, string version, bool includeInBuild = false)
{
Id = id;
Version = version;
IncludeInBuild = includeInBuild;
}
///
/// The .nupkg download URL from NuGet v3 flat container API.
///
public string DownloadUrl
{
get
{
var lowerId = Id.ToLowerInvariant();
var lowerVersion = Version.ToLowerInvariant();
return $"{NuGetConfig.NuGetBaseUrl}/{lowerId}/{lowerVersion}/{lowerId}.{lowerVersion}.nupkg";
}
}
///
/// Cached .nupkg filename.
///
public string CacheFileName => $"{Id}.{Version}.nupkg";
public override string ToString() => $"{Id} {Version}";
}
}