package com.atlassian.bitbucket.mirroring.mirror;

import com.atlassian.bitbucket.event.ApplicationEvent;
import com.atlassian.bitbucket.event.annotation.TransactionAware;
import com.atlassian.event.api.AsynchronousPreferred;

import javax.annotation.Nonnull;
import java.util.Date;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Event fired when a full synchronization has completed
 *
 * @since 4.3
 */
@TransactionAware
@AsynchronousPreferred
public class FullSynchronizationEvent extends ApplicationEvent {
    private final Date startDate;
    private final UpstreamServer upstream;

    public FullSynchronizationEvent(@Nonnull Object source, @Nonnull Date startDate, @Nonnull UpstreamServer upstream) {
        super(source);
        this.startDate = checkNotNull(startDate, "startDate");
        this.upstream = checkNotNull(upstream, "upstream");
    }

    @Nonnull
    public Date getStartDate() {
        return startDate;
    }

    @Nonnull
    public UpstreamServer getUpstream() {
        return upstream;
    }
}
