package org.limewire.core.api.download;

/**
 * An enum to describe the various general download states and their capabilities. 
 */
public enum DownloadState {
    /** Download finished and scanned. */
	DONE(false, false, true), 
	CONNECTING(true, false, false), 
	DOWNLOADING(true, false, false), 
	PAUSED(false, true, false), 
	FINISHING(false, false, false), 
    LOCAL_QUEUED(true, false, false), 
    REMOTE_QUEUED(true, false, false), 
	CANCELLED(false, false, false), 
	STALLED(false, false, false),
	TRYING_AGAIN(true, false, false),
	ERROR(false, false, false),
	RESUMING(false, false, false),
	/** Threat detected by dangerous file checker. */
	DANGEROUS(false, false, true);

	private final boolean pausable;
	private final boolean resumable;
	private final boolean finished;

	DownloadState(boolean pausable, boolean resumable, boolean finished) {
		this.pausable = pausable;
		this.resumable = resumable;
		this.finished = finished;
	}

	public boolean isPausable() {
		return pausable;
	}

	public boolean isResumable() {
		return resumable;
	}
	
	/**
	 * Returns true if the state represents a finished condition.
	 */
	public boolean isFinished() {
	    return finished;
	}
}
