/*
 * @(#)SftpTransferCompleteEvent.java
 *
 * Copyright (c) 2001-2004 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.sftp.events;

import com.jscape.inet.sftp.Sftp;

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

/**
 * This event is fired when upload or download was completed.
 */
public abstract class SftpTransferCompleteEvent
        extends SftpEvent {

    private final String fileName;
    private final String path;
    private final String localPath;
    private final long fileSize;
    private final long totalTime;

    /**
     * Creates a new event instance.
     *
     * @param source    the event source
     * @param fileName  the file name
     * @param path      the remote directory path the file was transferred to/from
     * @param localPath the local file path
     * @param fileSize  the file size
     * @param totalTime total transfer time
     */
    protected SftpTransferCompleteEvent(Sftp source,
                                        String fileName,
                                        String path,
                                        String localPath,
                                        long fileSize,
                                        long totalTime) {
        super(source);

        assertNotNull(fileName);
        this.fileName = fileName;

        this.path = path;
        this.localPath = localPath;
        this.fileSize = fileSize;
        this.totalTime = totalTime;
    }

    /**
     * Obtains the file name.
     *
     * @return the file name
     */
    public String getFilename() {
        return this.fileName;
    }

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

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

    /**
     * Obtains the file size.
     *
     * @return the file size
     */
    public long getFilesize() {
        return this.fileSize;
    }

    /**
     * Obtains the total transfer time.
     *
     * @return the total transfer time
     */
    public long getTime() {
        return this.totalTime;
    }

}
