using System.Xml.Serialization;
using Newtonsoft.Json;
using SabreTools.Core;
// TODO: Add item mappings for all fields
namespace SabreTools.DatItems.Formats
{
///
/// Represents a single release details item
///
[JsonObject("release_details"), XmlRoot("release_details")]
public class ReleaseDetails : DatItem
{
#region Fields
///
/// Id value
///
/// TODO: Is this required?
[JsonProperty("id", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("id")]
public string? Id { get; set; }
///
/// Directory name value
///
[JsonProperty("dirname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("dirname")]
public string? DirName { get; set; }
///
/// Rom info value
///
[JsonProperty("rominfo", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rominfo")]
public string? RomInfo { get; set; }
///
/// Category value
///
[JsonProperty("category", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("category")]
public string? Category { get; set; }
///
/// NFO name value
///
[JsonProperty("nfoname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nfoname")]
public string? NfoName { get; set; }
///
/// NFO size value
///
[JsonProperty("nfosize", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nfosize")]
public long? NfoSize { get; set; }
///
/// NFO CRC value
///
[JsonProperty("nfocrc", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nfocrc")]
public string? NfoCrc { get; set; }
///
/// Archive name value
///
[JsonProperty("archivename", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("archivename")]
public string? ArchiveName { get; set; }
///
/// Original format value
///
[JsonProperty("originalformat", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("originalformat")]
public string? OriginalFormat { get; set; }
///
/// Date value
///
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
public string? Date { get; set; }
///
/// Grpup value
///
[JsonProperty("group", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("group")]
public string? Group { get; set; }
///
/// Comment value
///
[JsonProperty("comment", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("comment")]
public string? Comment { get; set; }
///
/// Tool value
///
[JsonProperty("tool", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tool")]
public string? Tool { get; set; }
///
/// Region value
///
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
public string? Region { get; set; }
///
/// Origin value
///
[JsonProperty("origin", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("origin")]
public string? Origin { get; set; }
#endregion
#region Constructors
///
/// Create a default, empty ReleaseDetails object
///
public ReleaseDetails()
{
ItemType = ItemType.ReleaseDetails;
}
#endregion
#region Cloning Methods
///
public override object Clone()
{
return new ReleaseDetails()
{
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
Id = this.Id,
DirName = this.DirName,
RomInfo = this.RomInfo,
Category = this.Category,
NfoName = this.NfoName,
NfoSize = this.NfoSize,
NfoCrc = this.NfoCrc,
ArchiveName = this.ArchiveName,
OriginalFormat = this.OriginalFormat,
Date = this.Date,
Group = this.Group,
Comment = this.Comment,
Tool = this.Tool,
Region = this.Region,
Origin = this.Origin,
};
}
#endregion
#region Comparision Methods
///
public override bool Equals(DatItem? other)
{
// If we don't have a Details, return false
if (ItemType != other?.ItemType)
return false;
// Otherwise, treat it as a Details
ReleaseDetails? newOther = other as ReleaseDetails;
// If the Details information matches
return (Id == newOther!.Id
&& DirName == newOther.DirName
&& RomInfo == newOther.RomInfo
&& Category == newOther.Category
&& NfoName == newOther.NfoName
&& NfoSize == newOther.NfoSize
&& NfoCrc == newOther.NfoCrc
&& ArchiveName == newOther.ArchiveName
&& OriginalFormat == newOther.OriginalFormat
&& Date == newOther.Date
&& Group == newOther.Group
&& Comment == newOther.Comment
&& Tool == newOther.Tool
&& Region == newOther.Region
&& Origin == newOther.Origin);
}
#endregion
}
}