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

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

import java.util.Arrays;

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

/**
 * @author Alex Usun
 */
public class SshFxpExtendedReplyRaw
        extends SshFxpExtendedReply<SshFxpExtendedReplyRaw.Handler> {

    public final byte[] data;

    public SshFxpExtendedReplyRaw(int id, byte[] data) {
        super(id);

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

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

    @Override
    public String toString() {
        return "SshFxpExtendedReplyRaw {"
               + "id=" + this.id
               + ", data=" + Arrays.toString(this.data)
               + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

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

    }
}
