package com.atlassian.stash.internal.user;

import com.atlassian.bitbucket.permission.Permission;
import com.atlassian.bitbucket.permission.PermittedUser;
import com.atlassian.bitbucket.user.ApplicationUser;

import javax.annotation.Nonnull;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Associates a {@link Permission permission} with a {@link ApplicationUser user}.
 */
public class InternalPermittedUser extends InternalPermittedEntity implements PermittedUser {

    private final ApplicationUser user;

    public InternalPermittedUser(ApplicationUser user, int permissionWeight) {
        super(permissionWeight);

        this.user = checkNotNull(user, "A user is required");
    }

    @Nonnull
    @Override
    public ApplicationUser getUser() {
        return user;
    }
}
