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

import com.atlassian.bitbucket.hook.repository.RepositoryHookImplementor;
import com.atlassian.bitbucket.setting.Settings;

import javax.annotation.Nonnull;

/**
 * Callback that can be provided to {@link InternalRepositoryHookService} to visit enabled hooks and their associated
 * settings.
 *
 * @since 2.2
 */
public interface RepositoryHookSettingsCallback<T extends RepositoryHookImplementor> {

    /**
     * Visit a individual hook and any associated settings.
     *
     * @param key      unique key of the provided hook
     * @param hook     hook implementation
     * @param settings non-null settings for this hook (may contain no values if none are stored)
     * @return {@code true} if more hooks/settings should be provided; otherwise {@code false} to end visiting
     */
    boolean visit(@Nonnull String key, @Nonnull T hook, @Nonnull Settings settings);
}
