using System.Xml.Serialization;
using Newtonsoft.Json;
using SabreTools.Core;
namespace SabreTools.DatItems.Formats
{
///
/// Represents one conflocation
///
[JsonObject("conflocation"), XmlRoot("conflocation")]
public class ConfLocation : DatItem
{
#region Accessors
///
public override string? GetName() => GetFieldValue(Models.Metadata.ConfLocation.NameKey);
///
public override void SetName(string? name) => SetFieldValue(Models.Metadata.ConfLocation.NameKey, name);
#endregion
#region Constructors
///
/// Create a default, empty ConfLocation object
///
public ConfLocation()
{
_internal = new Models.Metadata.ConfLocation();
Machine = new Machine();
SetName(string.Empty);
ItemType = ItemType.ConfLocation;
}
///
/// Create a ConfLocation object from the internal model
///
public ConfLocation(Models.Metadata.ConfLocation? item)
{
_internal = item ?? [];
Machine = new Machine();
ItemType = ItemType.ConfLocation;
}
#endregion
#region Cloning Methods
///
public override object Clone()
{
return new ConfLocation()
{
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
_internal = this._internal?.Clone() as Models.Metadata.ConfLocation ?? [],
};
}
#endregion
}
}