package com.atlassian.bitbucket.event.repository;

import com.atlassian.event.api.AsynchronousPreferred;
import com.atlassian.bitbucket.repository.Repository;

import javax.annotation.Nonnull;

import static java.util.Objects.requireNonNull;

/**
 * Raised when the default branch of a repository is reconfigured (typically through repository settings).
 */
@AsynchronousPreferred
public class RepositoryDefaultBranchModifiedEvent extends RepositoryEvent {

    private final String newValue;

    public RepositoryDefaultBranchModifiedEvent(@Nonnull Object source, @Nonnull Repository repository,
                                                @Nonnull String newValue) {
        super(source, repository);
        this.newValue = requireNonNull(newValue, "newValue");
    }

    @Nonnull
    public String getNewValue() {
        return newValue;
    }
}
