using Newtonsoft.Json.Linq;

namespace EDPlayerJournal.Entries; 
public class DockedEntry : Entry {
    /// <summary>
    /// Name of the station
    /// </summary>
    public string? StationName { get; set; }

    /// <summary>
    /// Star system of the station
    /// </summary>
    public string? StarSystem { get; set; }

    /// <summary>
    /// System address
    /// </summary>
    public ulong? SystemAddress { get; set; }

    /// <summary>
    /// Faction owning the station.
    /// </summary>
    public string? StationFaction { get; set; }

    /// <summary>
    /// State of the station, new in Update 14
    /// </summary>
    public string? StationState { get; set; }

    protected override void Initialise() {
        StationName = JSON.Value<string>("StationName");
        StarSystem = JSON.Value<string>("StarSystem");
        SystemAddress = JSON.Value<ulong?>("SystemAddress");
        StationState = JSON.Value<string>("StationState");
        JObject? faction = JSON.Value<JObject>("StationFaction");
        if (faction != null) {
            StationFaction = faction.Value<string>("Name") ?? "";
        }
    }
}
