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 SshFxpSetStat
        extends Message<SshFxpSetStat.Handler> {

    public final int id;
    public final String path;
    public final FileAttributes attributes;

    public SshFxpSetStat(int id, String path, FileAttributes attributes) {
        this.id = id;

        assertNotNull(path);
        this.path = path;

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

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

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

    public interface Handler
            extends Message.HandlerBase {

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

    }
}
