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

import com.atlassian.soy.renderer.JsExpression;
import com.atlassian.soy.renderer.SoyClientFunction;
import com.google.common.collect.ImmutableSet;

import java.util.Set;

public class PathNameFunction implements SoyClientFunction {

    private static final Set<Integer> VALID_ARG_SIZES = ImmutableSet.of(1);

    @Override
    public JsExpression generate(JsExpression... args) {
        return new JsExpression("new (require('bitbucket/internal/model/path'))(" + args[0].getText() + ").getName()");
    }

    @Override
    public String getName() {
        return "path_name";
    }

    @Override
    public Set<Integer> validArgSizes() {
        return VALID_ARG_SIZES;
    }

}
