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

import java.util.LinkedHashMap;

/**
 * A view reference. This is hashmap-based to aid JSONification in Soy.
 */
public class ViewRef extends LinkedHashMap<String, Object> {
    public ViewRef(String name, boolean isDefault, ViewRefType type) {
        this(name, name, isDefault, type, null);
    }

    public ViewRef(String id, String displayId, boolean isDefault, ViewRefType type) {
        this(id, displayId, isDefault, type, null);
    }

    public ViewRef(String id, String displayId, boolean isDefault, ViewRefType type, String latestCommit) {
        put("id", id);
        put("displayId", displayId);
        put("isDefault", isDefault);
        put("type", type);
        put("latestCommit", latestCommit);
    }

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

    public String getDisplayId() {
        return (String) get("displayId");
    }

    public boolean isDefault() {
        return (Boolean) get("isDefault");
    }

    public ViewRefType getType() {
        return (ViewRefType) get("type");
    }

    public String getLatestCommit() {
        return (String) get("latestCommit");
    }
}
