package com.atlassian.bitbucket.internal.importer.rest;

import com.atlassian.bitbucket.rest.RestMapEntity;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import java.util.Map;

@JsonSerialize
public class RestExternalEntity extends RestMapEntity {

    public static final String AVATAR_URL = "avatarUrl";
    public static final String DESCRIPTION = "description";
    public static final String NAME = "name";

    protected RestExternalEntity(Map<String, Object> values) {
        super(values);
    }

    public RestExternalEntity(String avatarUrl, String description, String name) {
        put(AVATAR_URL, avatarUrl);
        put(DESCRIPTION, description);
        put(NAME, name);
    }

    @Nonnull
    @NotNull
    public String getAvatarUrl() {
        return getStringProperty(AVATAR_URL);
    }

    @Nullable
    public String getDescription() {
        return getStringProperty(DESCRIPTION);
    }

    @Nonnull
    @NotNull
    public String getName() {
        return getStringProperty(NAME);
    }
}
