package com.jscape.inet.sftp.protocol.v4.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 SshFxpSymLink
        extends Message<SshFxpSymLink.Handler> {

    public final int id;
    public final String linkPath;
    public final String targetPath;

    public SshFxpSymLink(int id, String linkPath, String targetPath) {
        this.id = id;

        assertNotNull(linkPath);
        this.linkPath = linkPath;

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

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

    @Override
    public String toString() {
        return "SshFxpSymLink {"
                + "id=" + this.id
                + ", linkPath='" + this.linkPath + '\''
                + ", targetPath='" + this.targetPath + '\''
                + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

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

    }
}
