package com.jscape.inet.ssh.protocol.v2.messages;

import com.jscape.inet.ssh.protocol.messages.Message;
import com.jscape.util.net.connection.MessageConnection;

import static com.jscape.util.Parameters.assertNotNull;

/**
 * @author Alex Usun
 */
public class SshMsgDebug
        extends Message<SshMsgDebug.Handler> {

    public final boolean alwaysDisplay;
    public final String message;
    public final String languageTag;

    public SshMsgDebug(boolean alwaysDisplay, String message, String languageTag) {
        this.alwaysDisplay = alwaysDisplay;

        assertNotNull(message);
        this.message = message;

        assertNotNull(languageTag);
        this.languageTag = languageTag;
    }

    @Override
    public Class handlerClass() {
        return Handler.class;
    }

    @Override
    public void accept(Handler handler, MessageConnection<Message> connection) {
        handler.handle(this, connection);
    }

    @Override
    public String toString() {
        return "SshMsgDebug {"
                + "alwaysDisplay=" + this.alwaysDisplay
                + ", message='" + this.message + '\''
                + ", languageTag='" + this.languageTag + '\''
                + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

        void handle(SshMsgDebug message, MessageConnection<Message> connection);

    }
}
