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

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

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

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

    public final int id;
    public final FileAttributes attributes;

    public SshFxpAttrs(int id, FileAttributes attributes) {
        this.id = id;

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

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

    @Override
    public String toString() {
        return "SshFxpAttrs {"
                + "id=" + this.id
                + ", attributes=" + this.attributes
                + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

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

    }
}
