2020-12-14 10:58:43 -08:00
|
|
|
|
using System.Xml.Serialization;
|
2020-09-02 16:31:23 -07:00
|
|
|
|
using Newtonsoft.Json;
|
2025-01-11 22:00:26 -05:00
|
|
|
|
using SabreTools.Core.Tools;
|
2020-09-02 16:31:23 -07:00
|
|
|
|
|
2021-02-02 10:23:43 -08:00
|
|
|
|
namespace SabreTools.DatItems.Formats
|
2020-09-02 16:31:23 -07:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents a condition on a machine or other item
|
|
|
|
|
|
/// </summary>
|
2020-09-08 10:12:41 -07:00
|
|
|
|
[JsonObject("condition"), XmlRoot("condition")]
|
2024-03-10 20:39:54 -04:00
|
|
|
|
public sealed class Condition : DatItem<Models.Metadata.Condition>
|
2020-09-02 16:31:23 -07:00
|
|
|
|
{
|
2024-03-10 20:39:54 -04:00
|
|
|
|
#region Fields
|
2023-08-15 01:38:01 -04:00
|
|
|
|
|
2024-03-10 20:39:54 -04:00
|
|
|
|
/// <inheritdoc>/>
|
|
|
|
|
|
protected override ItemType ItemType => ItemType.Condition;
|
2020-09-02 16:31:23 -07:00
|
|
|
|
|
2024-03-10 20:39:54 -04:00
|
|
|
|
/// <inheritdoc>/>
|
|
|
|
|
|
protected override string? NameKey => null;
|
2024-03-09 21:46:38 -05:00
|
|
|
|
|
2020-09-02 16:31:23 -07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-03-10 20:39:54 -04:00
|
|
|
|
#region Constructors
|
2020-09-02 16:31:23 -07:00
|
|
|
|
|
2024-03-10 20:39:54 -04:00
|
|
|
|
public Condition() : base() { }
|
2025-01-11 22:00:26 -05:00
|
|
|
|
public Condition(Models.Metadata.Condition item) : base(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Process flag values
|
|
|
|
|
|
if (GetStringFieldValue(Models.Metadata.Condition.RelationKey) != null)
|
|
|
|
|
|
SetFieldValue<string?>(Models.Metadata.Condition.RelationKey, GetStringFieldValue(Models.Metadata.Condition.RelationKey).AsEnumValue<Relation>().AsStringValue());
|
|
|
|
|
|
}
|
2020-09-02 16:31:23 -07:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|