using System.Linq;
using EDJournal;

namespace EliteBGS.BGS.LogGenerator {
    public class MicroResourcesFormat : LogFormatter {
        public string GenerateLog(Objective objective) {
            var total = objective.LogEntries.OfType<SellMicroResources>();
            long sum = total.Sum(x => x.TotalSum);

            if (total == null || total.Count() <= 0 || sum <= 0) {
                return "";
            }

            return string.Format("Sold {0} worth of Micro Resources\n",
                Credits.FormatCredits(sum));
        }
    }
}