package com.atlassian.stash.internal.repository.ref.restriction;

import com.atlassian.bitbucket.repository.ref.restriction.AccessGrantVisitor;
import com.atlassian.bitbucket.repository.ref.restriction.GroupAccessGrant;

import javax.annotation.Nonnull;

import static java.util.Objects.requireNonNull;

public class SimpleGroupAccessGrant implements GroupAccessGrant {

    private final String group;

    public SimpleGroupAccessGrant(String group) {
        this.group = requireNonNull(group, "group");
    }

    @Override
    public <T> T accept(@Nonnull AccessGrantVisitor<T> visitor) {
        return visitor.visit(this);
    }

    @Nonnull
    @Override
    public String getGroup() {
        return group;
    }
}
