package com.atlassian.stash.internal.hook.repository;

import com.atlassian.bitbucket.hook.repository.RepositoryHookImplementor;
import com.atlassian.bitbucket.hook.repository.RepositoryHookService;
import com.atlassian.bitbucket.repository.Repository;

import javax.annotation.Nonnull;

/**
 * Non-public extensions to the {@link RepositoryHookService} which are not intended to be available to plugins.
 *
 * @since 2.2
 */
public interface InternalRepositoryHookService extends RepositoryHookService {

    /**
     * Visit all enabled hooks with their associated settings with the provided {@link RepositoryHookSettingsCallback}.
     *
     * @param repository to load enabled settings from
     * @param type       of the hooks to load
     * @param callback   callback for visiting each hook
     * @return {@code false} if visiting of the hooks was terminated early by the {@code callback}, otherwise {@code true}
     */
    <T extends RepositoryHookImplementor> boolean visitEnabledHooks(@Nonnull Repository repository,
                                                                    @Nonnull Class<T> type,
                                                                    @Nonnull RepositoryHookSettingsCallback<T> callback);
}
