using System.Linq;
using System.Text;
using EDJournal;

namespace EliteBGS.BGS.LogGenerator {
    public class VoucherFormat : LogFormatter {
        public string GenerateLog(Objective objective) {
            StringBuilder builder = new StringBuilder();
            var missions = objective.LogEntries
                .OfType<Vouchers>()
                .Where(x => x.IsEnabled)
                ;

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

            foreach (var m in missions) {
                builder.AppendFormat("Handed in {0} vouchers for {1}\n", m.Type, m.Faction);
                builder.AppendFormat("(Total value: {0})\n", Credits.FormatCredits(m.TotalSum));
                builder.AppendFormat("\n");
            }

            return builder.ToString().Trim();
        }
    }
}