using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.Linq;

namespace EDPlayerJournal.Entries; 
public class SellExplorationDataEntry : Entry {
    public long BaseValue { get; set; }
    public long Bonus { get; set; }
    public long TotalEarnings { get; set; }

    public List<string> Systems { get; set; } = new List<string>();
    public List<string> Discovered { get; set; } = new List<string>();

    protected override void Initialise() {
        BaseValue = JSON.Value<long?>("BaseValue") ?? 0;
        Bonus = JSON.Value<long?>("Bonus") ?? 0;
        TotalEarnings = JSON.Value<long?>("TotalEarnings") ?? 0;

        var sys = JSON.Value<JArray>("Systems");
        if (sys != null) {
            Systems = sys.Select(x => x.ToString()).ToList<string>();
        }

        var dis = JSON.Value<JArray>("Discovered");
        if (dis != null) {
            Discovered = dis.Select(x => x.ToString()).ToList<string>();
        }
    }
}