using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InABox.DynamicGrid
{
    public interface IFunctionParameter
    {
        string Name { get; }

        string ParamType { get; }
    }

    public class FunctionParameter : IFunctionParameter
    {
        public string Name { get; set; }

        public string ParamType { get; set; }

        public FunctionParameter(string name, string paramType)
        {
            Name = name;
            ParamType = paramType;
        }
    }
    public class FunctionParameter<TParam> : IFunctionParameter
    {
        public string Name { get; set; }

        public string ParamType => typeof(TParam).ToString();

        public FunctionParameter(string name)
        {
            Name = name;
        }
    }

    public class FunctionTemplate
    {
        public string Name { get; set; }

        public string Description { get; set; }

        public List<IFunctionParameter> Parameters { get; set; }

        public string Template => $"{Name}({string.Join(", ", Parameters.Select(x => x.Name))})";

        public string Tooltip => $"{Name}({string.Join(", ", Parameters.Select(x => string.IsNullOrWhiteSpace(x.ParamType) ? x.Name : $"{x.ParamType} {x.Name}"))})";
    }
}
