package com.atlassian.stash.internal.web.soy.functions.nav;

import com.atlassian.soy.renderer.JsExpression;
import com.atlassian.stash.internal.web.soy.functions.SoyArgumentUtils;
import com.atlassian.bitbucket.nav.NavBuilder;
import com.google.common.collect.ImmutableSet;

public class RepoCommitNavFunction extends BaseRepoNavFunction {

    public RepoCommitNavFunction(NavBuilder navBuilder) {
        super(navBuilder, "nav_commit", ImmutableSet.of(3, 4, 5));
    }

    @Override
    protected JsNavBuilder initJsBuilder(JsExpression... jsExpressions) {
        return repo(jsExpressions).commit(jsExpressions[2]).withParamsIfAvailable(jsExpressions, 3).withFragmentIfAvailable(jsExpressions, 4);
    }

    @Override
    protected NavBuilder.Builder initBuilder(Object... args) {
        ensureValidArgumentCount(args);
        return repo(args).commit(SoyArgumentUtils.getStringArgument(args, 2));
    }
}



