package it.polimi.ingsw.gc14.Network;

import it.polimi.ingsw.gc14.Controller.GameController;

import java.io.Serializable;

public abstract class NetworkEvent implements Serializable {
    protected String username;
    public String getUsername() {
        return username;
    }
    protected EventType eventType;
    public EventType getEventType() {return eventType;}
    protected boolean isError;
    public boolean getIsError() {return isError;}
    public void setIsError(boolean isError) {this.isError = isError;}

    protected NetworkEvent(String username, EventType eventType, boolean isError) {
        this.username = username;
        this.eventType = eventType;
        this.isError = isError;
    }

    @Override
    public String toString() {
        if(isError) {
            return ("ERROR: action " + eventType.toString());
        } else {
            return ("ACTION: action " + eventType.toString());
        }
    }

    public abstract boolean apply(GameController gameController);
}
