using EDPlayerJournal.Entries; using System.ComponentModel.DataAnnotations.Schema; namespace EDPlayerJournal.BGS; public class Transaction : IComparable { public List Entries { get; } = new List(); 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 { get { var items = Entries .OrderBy(x => x.Timestamp) .ToArray() ; if (items == null || items.Length == 0) { return null; } Entry last = items.Last(); return last.Timestamp; } } /// /// 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. /// public virtual bool SystemContribution { get; } = false; /// /// Returns true if this transaction was completed in legacy ED /// public bool IsLegacy { get; set; } = false; /// /// Controlling faction of the station this entry was made/turned into. /// 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; } /// /// Whether this transaction type only benefits the controlling faction or not, default: no /// public virtual bool OnlyControllingFaction { get { return false; } } public virtual int CompareTo(Transaction? other) { throw new NotImplementedException("not implemented"); } public string? Name => ToString(); }