

package bt.event;

import bt.metainfo.Torrent;
import bt.metainfo.TorrentId;

/**
 * Indicates, that torrent's metadata has been fetched.
 *
 * @since 1.9
 */
public class MetadataAvailableEvent extends BaseEvent implements TorrentEvent {

    private final TorrentId torrentId;
    private final Torrent torrent;

    protected MetadataAvailableEvent(long id, long timestamp, TorrentId torrentId, Torrent torrent) {
        super(id, timestamp);
        this.torrentId = torrentId;
        this.torrent = torrent;
    }

    @Override
    public TorrentId getTorrentId() {
        return torrentId;
    }

    /**
     * @since 1.9
     */
    public Torrent getTorrent() {
        return torrent;
    }

    @Override
    public String toString() {
        return "[" + this.getClass().getSimpleName() + "] id {" + getId() + "}, timestamp {" + getTimestamp() +
                "}, torrent {" + torrentId + "}";
    }
}
