package com.jscape.inet.sftp.protocol.v3.messages;

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

import java.util.Map;

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

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

    public final int version;
    public final Map<String, String> extensionData;

    public SshFxpInit(int version, Map<String, String> extensionData) {
        this.version = version;

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

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

    @Override
    public String toString() {
        return "SshFxpInit {"
                + "version=" + this.version
                + ", extensionData=" + this.extensionData
                + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

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

    }
}
