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

/**
 * 条件分支
 * @TODO: 当前类目前主要用于生成文档
 */
export class IfStatement extends ExpressionNode {
    /**
     * 逻辑节点类型
     */
    @immutable()
    public readonly type: LOGIC_TYPE = LOGIC_TYPE.IfStatement;
    /**
     * 条件
     */
    @immutable()
    public readonly test: ExpressionNode = undefined;
    /**
     * then
     */
    @immutable()
    public readonly consequent: Array<LogicNode> = [];
    /**
     * else
     */
    @immutable()
    public readonly alternate: Array<LogicNode> = [];
    /**
     * 生成 JS 脚本
     */
    toScript() {
        return '';
    }
}
