namespace EDPlayerJournal.Entries; 
public class MarketSellEntry : Entry {
    /// <summary>
    /// Total value
    /// </summary>
    public int TotalSale { get; set; }
    /// <summary>
    /// How many.
    /// </summary>
    public int Count { get; set; }
    /// <summary>
    /// Average price paid
    /// </summary>
    public int AvgPricePaid { get; set; }
    /// <summary>
    /// Cargo type
    /// </summary>
    public string? Type { get; set; }
    /// <summary>
    /// Localised name of the cargo sold, may be null.
    /// </summary>
    public string? TypeLocalised { get; set; }
    /// <summary>
    /// Price per unit
    /// </summary>
    public int SellPrice { get; set; }
    /// <summary>
    /// Whether the goods were illegal in the target system.
    /// </summary>
    public bool IllegalGoods { get; set; }
    /// <summary>
    /// Whether the goods were stolen
    /// </summary>
    public bool StolenGoods { get; set; }
    /// <summary>
    /// Whether the goods were sold to the black market
    /// </summary>
    public bool BlackMarket { get; set; }

    protected override void Initialise() {
        Type = JSON.Value<string>("Type");
        TypeLocalised = JSON.Value<string>("Type_Localised");
        TotalSale = JSON.Value<int?>("TotalSale") ?? 0;
        Count = JSON.Value<int?>("Count") ?? 0;
        AvgPricePaid = JSON.Value<int?>("AvgPricePaid") ?? 0;
        IllegalGoods = JSON.Value<bool?>("IllegalGoods") ?? false;
        StolenGoods = JSON.Value<bool?>("StolenGoods") ?? false;
        BlackMarket = JSON.Value<bool?>("BlackMarket") ?? false;
    }
}
