import { immutable } from '../../decorators';
import { ExpressionNode, LOGIC_TYPE } from '../LogicItem';

/**
 * 内置函数参数
 * @TODO: 当前类目前主要用于生成文档
 */
export class BuiltInFuncParam extends ExpressionNode {
    /**
     * 逻辑节点类型
     */
    @immutable()
    public readonly type: LOGIC_TYPE = LOGIC_TYPE.BuiltInFuncParam;
    /**
     * 参数名
     */
    @immutable()
    public readonly name: string = undefined;
    /**
     * 参数类型
     */
    @immutable()
    public readonly schema: any = undefined;
    /**
     * 参数值
     */
    @immutable()
    public readonly builtInFuncParamValue: ExpressionNode = undefined;
    /**
     * 生成 JS 脚本
     */
    toScript() {
        return this.builtInFuncParamValue ? this.builtInFuncParamValue.toScript() : null;
    }
}
