package com.atlassian.bitbucket.internal.mirroring.mirror.auth;

import com.atlassian.bitbucket.user.ApplicationUser;
import com.atlassian.bitbucket.user.ApplicationUserVisitor;
import com.atlassian.bitbucket.user.UserType;

import javax.annotation.Nonnull;

public class SimpleUser implements ApplicationUser {

    private final String username;

    public SimpleUser(String username) {
        this.username = username;
    }

    @Override
    public String getEmailAddress() {
        return null;
    }

    @Nonnull
    @Override
    public String getName() {
        return username;
    }

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

    @Nonnull
    @Override
    public String getDisplayName() {
        return username;
    }

    @Override
    public int getId() {
        return -1;
    }

    @Nonnull
    @Override
    public UserType getType() {
        return UserType.NORMAL;
    }

    @Override
    public boolean isActive() {
        return true;
    }

    @Nonnull
    @Override
    public String getSlug() {
        // Cloud usernames are always URL safe.
        return username;
    }
}
