/*
 * @(#)FtpErrorEvent.java
 *
 * Copyright (c) 2013 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */
package com.jscape.inet.ftp;

/**
 * Fired when file is uploaded to FTP server.
 */
public class FtpErrorEvent
        extends FtpEvent {

    private final String filename;
    private final String path;
    private final String localPath;
    private final int mode;

    /**
     * Creates FtpUploadEvent.
     *
     * @param source    the source of the event
     * @param filename  the file uploaded
     * @param path      the remote directory path flie was uploaded to
     * @param localPath the the local file path
     * @param size      the size of the file uploaded
     * @param time      the time to upload file in milliseconds
     */
    public FtpErrorEvent(Object source,
                         String filename,
                         String path,
                         String localPath,
                         int mode) {
        super(source);

        this.filename = filename;
        this.path = path;
        this.localPath = localPath;
        this.mode = mode;
    }

    /**
     * Gets name of file uploaded.
     *
     * @return filename
     */
    public String getFilename() {
        return this.filename;
    }

    /**
     * Gets remote directory path that file was uploaded to
     *
     * @return remote directory path
     */
    public String getPath() {
        return this.path;
    }

    /**
     * Return local file path.
     *
     * @return local file path
     */
    public String getLocalPath() {
        return this.localPath;
    }

    /**
     * Gets total bytes transmitted
     *
     * @return bytes transmitted
     */
    public long getMode() {
        return this.mode;
    }

    public void accept(FtpListener listener) {
    }

    /**
     * Gets String equivalent of this event.
     *
     * @return the String equivalent for this event
     */
    public String toString() {
        return
                String.format("FtpErrorEvent: %s, %s, %s, %d",
                              this.filename,
                              this.path,
                              this.localPath,
                              this.mode);
    }
}
