using EDPlayerJournal.BGS;
using EDPlayerJournal.Entries;

internal class CommanderParser : ITransactionParserPart {
    public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
        CommanderEntry commanderEntry = (CommanderEntry)entry;
        if (commanderEntry != null && !string.IsNullOrEmpty(commanderEntry.FullName)) {
            if (!context.Commanders.Contains(commanderEntry.FullName)) {
                context.Commanders.Add(commanderEntry.FullName);
            }
        }
        // A commander entry happens when you log out, and log back in again
        // for example when switching from Open, to Solo or PG.
        context.DiscernCombatZone(transactions, entry);
        context.ResetCombatZone();
    }
}