export class DeckManager { static validate(deck, cardManager) { const errors = []; if (!deck.commander) { errors.push('No commander selected'); } else { const cmd = cardManager.getCard(deck.commander); if (!cmd || cmd.type !== 'commander') errors.push('Invalid commander'); } if (!deck.cards || deck.cards.length < 3) { errors.push('Deck needs at least 3 assault cards'); } if (deck.cards && deck.cards.length > 10) { errors.push('Deck can have at most 10 assault cards'); } const counts = {}; for (const id of (deck.cards || [])) { counts[id] = (counts[id] || 0) + 1; if (counts[id] > 3) errors.push(`Too many copies of ${id} (max 3)`); } return { valid: errors.length === 0, errors }; } static createStarterDeck(cardManager) { return { id: 'deck_starter', name: 'Starter Deck', commander: 'imp_cmd_1', cards: [ 'imp_trooper_1', 'imp_trooper_1', 'imp_trooper_1', 'imp_gunner_1', 'imp_gunner_1', 'imp_gunner_1', 'imp_guardian_1', 'imp_guardian_1', 'imp_guardian_1', ] }; } }