using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PSProxmoxVE.Core.Utilities;
namespace PSProxmoxVE.Core.Models.Backup;
///
/// Represents one guest not covered by any backup job, as returned by
/// the /cluster/backup-info/not-backed-up endpoint.
///
public class PveBackupInfo
{
///
/// Name of the guest.
///
[JsonProperty("name")]
public string? Name { get; set; }
///
/// Type of the guest ("qemu" or "lxc").
///
[JsonProperty("type")]
public string? Type { get; set; }
///
/// VMID of the guest.
///
[JsonProperty("vmid")]
public int? VmId { get; set; }
///
/// Raw landing spot for any key not mapped to a typed property above.
///
[JsonExtensionData]
private IDictionary? ExtensionData { get; set; }
private Dictionary? _additionalProperties;
///
/// Any keys not surfaced as a typed property above. Keys map to native
/// .NET values so the dictionary works naturally in PowerShell pipelines.
///
[JsonIgnore]
public Dictionary AdditionalProperties =>
_additionalProperties ??= ExtensionData == null
? new Dictionary()
: ExtensionData.ToDictionary(kvp => kvp.Key, kvp => JsonHelper.ToNative(kvp.Value));
///
public override string ToString()
{
return $"{Type ?? "guest"} {VmId?.ToString() ?? "?"} ({Name ?? "N/A"}) not backed up";
}
}