package floor.input;

import java.io.Serializable;

import common.Direction;
import common.ErrorType;

/**
 * A Class to represent an input event read in from a file
 */
public class InputEvent implements Serializable {
	private static final long serialVersionUID = 6184435321340591121L;
	private long inputTimeMs;
	private int inputFloor;
	private Direction directionButton;
	private int carButton;
	private ErrorType errorType;
	private int errorFloor;

	/**
	 * Construct an input event with specific values
	 *
	 * @param inputTime       the time at which the input occurs, offset from
	 *                        program start time
	 * @param inputFloor
	 * @param directionButton
	 * @param carButton
	 * @param errorType       the type of error to occur, null if none
	 * @param errorFloor      the floor at which the error occurs
	 */
	public InputEvent(long inputTime, int inputFloor, Direction directionButton, int carButton, ErrorType errorType,
			int errorFloor) {
		this.inputTimeMs = inputTime;
		this.inputFloor = inputFloor;
		this.directionButton = directionButton;
		this.carButton = carButton;
		this.errorType = errorType;
		this.errorFloor = errorFloor;
	}

	public long getInputTimeMs() {
		return inputTimeMs;
	}

	public int getInputFloor() {
		return inputFloor;
	}

	public Direction getDirectionButton() {
		return directionButton;
	}

	public int getCarButton() {
		return carButton;
	}

	public ErrorType getErrorType() {
		return errorType;
	}

	public int getErrorFloor() {
		return errorFloor;
	}

	@Override
	public String toString() {
		return "InputEvent [inputTimeMs=" + inputTimeMs + ", inputFloor=" + inputFloor + ", directionButton="
				+ directionButton + ", carButton=" + carButton + ", errorType=" + errorType + ", errorFloor="
				+ errorFloor + "]";
	}
}
