package eu.jonahbauer.wizard.common.messages.server;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import org.intellij.lang.annotations.MagicConstant;

@Getter
@EqualsAndHashCode(callSuper = true)
public final class NackMessage extends ServerMessage implements Response {
    public static final int MALFORMED_MESSAGE = 100;
    public static final int UNEXPECTED_MESSAGE = 101;

    public static final int ILLEGAL_ARGUMENT = 200;
    public static final int NOT_FOUND = 210;
    public static final int SESSION_NOT_FOUND = 211;
    public static final int PLAYER_NOT_FOUND = 212;
    public static final int PLAYER_NAME_TAKEN = 220;
    public static final int PLAYER_NAME_NOT_ALLOWED = 221;
    public static final int SESSION_NAME_TAKEN = 230;
    public static final int SESSION_NAME_NOT_ALLOWED = 231;

    public static final int ILLEGAL_STATE = 300;
    public static final int GAME_ALREADY_STARTED = 301;
    public static final int GAME_NOT_YET_STARTED = 302;
    public static final int SESSION_FULL = 303;
    public static final int ALREADY_CONNECTED = 304;

    @Deprecated
    public static final int BAD_REQUEST = 999;

    private final int code;
    private final @NonNull String message;

    public NackMessage(@MagicConstant(valuesFromClass = NackMessage.class) int code, @NonNull String message) {
        this.code = code;
        this.message = message;
    }
}
