# Loop Node Configuration
# This file defines the metadata for the Loop workflow node
# The corresponding Python implementation is in: pkg/workflow/nodes/loop.py

name: loop
category: control
icon: "🔁"
color: '#8b5cf6'
description: 'workflows.nodes.loopDescription'

inputs:
  - name: items
    type: array
    required: false
    label:
      en_US: Items
      zh_Hans: 项目
    description:
      en_US: Items to iterate over
      zh_Hans: 要遍历的项目

outputs:
  - name: item
    type: any
    label:
      en_US: Item
      zh_Hans: 当前项
    description:
      en_US: Current item in iteration
      zh_Hans: 迭代中的当前项
  - name: index
    type: number
    label:
      en_US: Index
      zh_Hans: 索引
    description:
      en_US: Current iteration index
      zh_Hans: 当前迭代索引
  - name: completed
    type: any
    label:
      en_US: Completed
      zh_Hans: 完成
    description:
      en_US: Output after loop completes
      zh_Hans: 循环完成后的输出

config:
  - name: loop_type
    type: select
    required: true
    default: foreach
    options:
      - foreach
      - while
      - count
    label:
      en_US: Loop Type
      zh_Hans: 循环类型
    description:
      en_US: Type of loop to execute
      zh_Hans: 要执行的循环类型

  - name: max_iterations
    type: integer
    default: 100
    label:
      en_US: Max Iterations
      zh_Hans: 最大迭代次数
    description:
      en_US: Maximum number of iterations
      zh_Hans: 最大迭代次数

  - name: count
    type: integer
    default: 10
    label:
      en_US: Count
      zh_Hans: 计数
    description:
      en_US: Number of times to iterate
      zh_Hans: 迭代次数

  - name: while_condition
    type: string
    default: ""
    label:
      en_US: While Condition
      zh_Hans: While 条件
    description:
      en_US: Condition expression to continue looping
      zh_Hans: 继续循环的条件表达式

  - name: parallel
    type: boolean
    default: false
    label:
      en_US: Parallel Execution
      zh_Hans: 并行执行
    description:
      en_US: Execute iterations in parallel
      zh_Hans: 并行执行迭代

  - name: parallel_limit
    type: integer
    default: 5
    label:
      en_US: Parallel Limit
      zh_Hans: 并行限制
    description:
      en_US: Maximum number of parallel executions
      zh_Hans: 最大并行执行数
