namespace EDPlayerJournal.Entries;

public class ApproachSettlementEntry : Entry {
    /// <summary>
    /// Settlement name
    /// </summary>
    public string? Name { get; set; } = null;

    /// <summary>
    /// Market ID of the settlement
    /// </summary>
    public long? MarketID { get; set; } = null;

    /// <summary>
    /// System ID
    /// </summary>
    public long? SystemAddress { get; set; } = null;

    /// <summary>
    /// Body ID
    /// </summary>
    public long? BodyID { get; set; } = null;

    /// <summary>
    /// Name of the planet
    /// </summary>
    public string? BodyName { get; set; } = null;

    /// <summary>
    /// Planet latitude
    /// </summary>
    public double Latitude { get; set; } = 0.0;

    /// <summary>
    /// Planet longitude
    /// </summary>
    public double Longitude { get; set; } = 0.0;

    protected override void Initialise() {
        Name = JSON.Value<string?>("Name");
        MarketID = JSON.Value<long?>("MarketID");
        SystemAddress = JSON.Value<long?>("SystemID");
        BodyID = JSON.Value<long?>("BodyID");
        BodyName = JSON.Value<string?>("BodyName");
        Longitude = JSON.Value<double?>("Longitude") ?? 0.0;
        Latitude = JSON.Value<double?>("Latitude") ?? 0.0;
    }
}
