package com.atlassian.bitbucket.web.conditions;

import com.atlassian.plugin.PluginParseException;
import com.atlassian.plugin.web.Condition;
import com.atlassian.bitbucket.license.LicenseService;

import java.util.Map;

/**
 * Verifies that Stash has a valid license which is not over its limits
 */
public class HasLicenseStatusCondition implements Condition {

    private final LicenseService licenseService;

    public HasLicenseStatusCondition(LicenseService licenseService) {
        this.licenseService = licenseService;
    }

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

    @Override
    public boolean shouldDisplay(Map<String, Object> context) {
        return licenseService.getStatus() != null;
    }
}
