package com.atlassian.bitbucket.mirroring.upstream;

import com.atlassian.plugin.PluginParseException;
import com.atlassian.plugin.web.Condition;

import java.util.Map;

/**
 * Verifies that at least one mirror is attached to the current instance
 *
 * @since 4.3
 */
public class IsMirrorAttachedCondition implements Condition {

    private MirrorService mirrorService;

    public IsMirrorAttachedCondition(MirrorService mirrorService) {
        this.mirrorService = mirrorService;
    }

    @Override
    public void init(Map<String, String> map) throws PluginParseException {
    }

    @Override
    public boolean shouldDisplay(Map<String, Object> map) {
        return mirrorService.hasAny();
    }
}
