package com.atlassian.bitbucket.mirroring.mirror;

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

import javax.annotation.Nonnull;

import static java.util.Objects.requireNonNull;

/**
 * @since 4.3
 */
@TransactionAware
public abstract class UpstreamLifecycleEvent extends ApplicationEvent {
    private final UpstreamServer upstreamServer;

    protected UpstreamLifecycleEvent(@Nonnull Object source, @Nonnull UpstreamServer upstreamServer) {
        super(source);
        this.upstreamServer = requireNonNull(upstreamServer, "upstreamServer");
    }

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