package com.atlassian.stash.internal.web.repos;

import java.util.LinkedHashMap;

/**
 * A view reference type. This is hashmap-based to aid JSONification in Soy.
 */
public class ViewRefType extends LinkedHashMap<String, Object> {
    public static final String BRANCH = "branch".intern();
    public static final String TAG = "tag".intern();
    public static final String COMMIT = "commit".intern();

    public ViewRefType(String id, String name) {
        put("id", id);
        put("name", name);
    }

    public String getId() {
        return (String) get("id");
    }

    public String getName() {
        return (String) get("name");
    }

    public boolean isBranch() {
        return BRANCH.equalsIgnoreCase(getId());
    }

    public boolean isTag() {
        return TAG.equalsIgnoreCase(getId());
    }

    public boolean isCommit() {
        return COMMIT.equalsIgnoreCase(getId());
    }
}
