2022-11-01 18:01:28 +01:00
|
|
|
|
using EDPlayerJournal.Entries;
|
2022-11-25 23:06:08 +01:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2022-11-01 18:01:28 +01:00
|
|
|
|
|
|
|
|
|
namespace EDPlayerJournal.BGS;
|
|
|
|
|
|
|
|
|
|
public class Transaction : IComparable<Transaction> {
|
|
|
|
|
public List<Entry> Entries { get; } = new List<Entry>();
|
|
|
|
|
|
2022-12-09 17:51:46 +01:00
|
|
|
|
public string CompletedAt {
|
|
|
|
|
get {
|
|
|
|
|
DateTime? datetime = CompletedAtDateTime;
|
|
|
|
|
if (datetime == null) {
|
|
|
|
|
return "Unknown";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return datetime.Value.ToString("dd.MM.yyyy HH:mm UTC");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual DateTime? CompletedAtDateTime {
|
2022-11-01 18:01:28 +01:00
|
|
|
|
get {
|
|
|
|
|
var items = Entries
|
|
|
|
|
.OrderBy(x => x.Timestamp)
|
|
|
|
|
.ToArray()
|
|
|
|
|
;
|
|
|
|
|
if (items == null || items.Length == 0) {
|
2022-12-09 17:51:46 +01:00
|
|
|
|
return null;
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Entry last = items.Last();
|
2022-12-09 17:51:46 +01:00
|
|
|
|
return last.Timestamp;
|
2022-11-01 18:01:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-03 15:01:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the transaction helps the entire system.
|
|
|
|
|
/// While all transactions are related to one faction, sometimes their
|
|
|
|
|
/// overall effect on the system as a whole is more important, than to
|
|
|
|
|
/// their faction. For example, rescuing refugees helps the Thargoid war
|
|
|
|
|
/// effort in the system as a whole, not just for the faction.
|
|
|
|
|
/// So this is true for transactions that help the system as a whole.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual bool SystemContribution { get; } = false;
|
|
|
|
|
|
2022-11-29 16:30:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns true if this transaction was completed in legacy ED
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsLegacy { get; set; } = false;
|
|
|
|
|
|
2022-11-01 18:01:28 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Controlling faction of the station this entry was made/turned into.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? ControllingFaction { get; set; }
|
|
|
|
|
public string? Station { get; set; }
|
|
|
|
|
public string? System { get; set; }
|
|
|
|
|
public ulong SystemAddress { get; set; }
|
|
|
|
|
public string? Faction { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this transaction type only benefits the controlling faction or not, default: no
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual bool OnlyControllingFaction {
|
|
|
|
|
get { return false; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual int CompareTo(Transaction? other) {
|
|
|
|
|
throw new NotImplementedException("not implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string? Name => ToString();
|
|
|
|
|
}
|