package ru.alphatech.icfpc.game;

import ru.alphatech.icfpc.cards.ICard;

public class Batch {
	
	public enum OperationType {
		CARD_TO_SLOT,
		SLOT_TO_CARD
	}
	
	OperationType operationType;
	
	public ICard card = null;
	public Slot  slot = null;
	
	public Batch(OperationType type, ICard card, Slot slot){
		this.operationType = type;
		this.card = card;
		this.slot = slot;
	}

	@Override
	public String toString() {
		if(operationType == null || card == null || slot == null)
			throw new ICFPCException();
		StringBuilder ret = new StringBuilder();
		switch(operationType){
		case CARD_TO_SLOT:
			ret.append("1\n");
			ret.append(card.getName() + "\n");
			ret.append(slot.getId() + "\n");
			break;
		case SLOT_TO_CARD:
			ret.append("2\n");
			ret.append(slot.getId() + "\n");
			ret.append(card.getName() + "\n");
			break;
		}
		return ret.toString();
	}
	
}
