package com.atlassian.stash.internal.plugin.hooks.allapprovers;

import com.atlassian.analytics.api.annotations.EventName;
import com.atlassian.bitbucket.audit.Channels;
import com.atlassian.bitbucket.audit.Priority;
import com.atlassian.bitbucket.event.annotation.Audited;
import com.atlassian.bitbucket.event.repository.RepositoryEvent;
import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.event.api.AsynchronousPreferred;

import javax.annotation.Nonnull;

@AsynchronousPreferred
@EventName("stash.merge.check.all.approvers.changed")
@Audited(converter = AllApproversMergeCheckChangedEventConverter.class, channels = {Channels.REPOSITORY_UI}, priority = Priority.HIGH)
public class AllApproversMergeCheckConfigChangedEvent extends RepositoryEvent {

    private final boolean isEnabled;

    protected AllApproversMergeCheckConfigChangedEvent(@Nonnull Object source, Repository repository, boolean isEnabled) {
        super(source, repository);
        this.isEnabled = isEnabled;
    }

    public boolean isEnabled() {
        return isEnabled;
    }
}
