using System.Xml.Serialization;
using Newtonsoft.Json;
using SabreTools.Core;
namespace SabreTools.DatItems.Formats
{
///
/// Represents which SoftwareList(s) is associated with a set
///
///
/// TODO: Add new fields to documentation
///
[JsonObject("softwarelist"), XmlRoot("softwarelist")]
public class SoftwareList : DatItem
{
#region Accessors
///
public override string? GetName() => GetFieldValue(Models.Metadata.SoftwareList.NameKey);
///
public override void SetName(string? name) => SetFieldValue(Models.Metadata.SoftwareList.NameKey, name);
#endregion
#region Constructors
///
/// Create a default, empty SoftwareList object
///
public SoftwareList()
{
_internal = new Models.Metadata.SoftwareList();
SetName(string.Empty);
SetFieldValue(Models.Metadata.DatItem.TypeKey, ItemType.SoftwareList);
SetFieldValue(DatItem.MachineKey, new Machine());
}
///
/// Create a SoftwareList object from the internal model
///
public SoftwareList(Models.Metadata.SoftwareList? item)
{
_internal = item ?? [];
SetFieldValue(Models.Metadata.DatItem.TypeKey, ItemType.SoftwareList);
SetFieldValue(DatItem.MachineKey, new Machine());
}
#endregion
#region Cloning Methods
public override object Clone()
{
return new SoftwareList()
{
_internal = this._internal?.Clone() as Models.Metadata.SoftwareList ?? [],
};
}
#endregion
}
}