package com.atlassian.stash.internal.lifecycle;

import com.atlassian.bitbucket.util.Progress;
import org.springframework.context.ApplicationEvent;

import javax.annotation.Nonnull;

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

/**
 * An <i>internal-only</i> event for updating startup {@link Progress progress}.
 * <p>
 * <b>Note</b>: This event is not intended to be published using the Atlassian Events {@code EventPublisher}; it
 * should be published using the Spring {@code ApplicationContext} or {@code ApplicationEventPublisher} instead
 * so that it does not get dispatched to general listeners (including plugins).
 *
 * @since 3.2
 */
public class StartupProgressEvent extends ApplicationEvent {

    private final Progress progress;

    public StartupProgressEvent(@Nonnull Object source, @Nonnull Progress progress) {
        super(source);

        this.progress = checkNotNull(progress, "progress");
    }

    @Nonnull
    public Progress getProgress() {
        return progress;
    }
}
