# Copyright (c) 2025 Patrick Motsch
# Flow control node definitions.

FLOW_NODES = [
    {
        "id": "flow.ifElse",
        "category": "flow",
        "label": {"en": "If / Else", "de": "Wenn / Sonst", "fr": "Si / Sinon"},
        "description": {"en": "Branch based on condition", "de": "Verzweigung nach Bedingung", "fr": "Branche selon condition"},
        "parameters": [
            {"name": "condition", "type": "string", "required": True, "description": {"en": "Expression to evaluate (e.g. {{value}} > 0)", "de": "Bedingung", "fr": "Condition"}},
        ],
        "inputs": 1,
        "outputs": 2,
        "executor": "flow",
        "meta": {"icon": "mdi-source-branch", "color": "#FF9800"},
    },
    {
        "id": "flow.switch",
        "category": "flow",
        "label": {"en": "Switch", "de": "Switch", "fr": "Switch"},
        "description": {"en": "Multiple branches based on value", "de": "Mehrere Zweige nach Wert", "fr": "Branches multiples selon valeur"},
        "parameters": [
            {"name": "value", "type": "string", "required": True, "description": {"en": "Value to match", "de": "Zu vergleichender Wert", "fr": "Valeur à comparer"}},
            {"name": "cases", "type": "array", "required": False, "description": {"en": "List of cases", "de": "Fälle", "fr": "Cas"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "executor": "flow",
        "meta": {"icon": "mdi-swap-horizontal", "color": "#FF9800"},
    },
    {
        "id": "flow.merge",
        "category": "flow",
        "label": {"en": "Merge", "de": "Zusammenführen", "fr": "Fusionner"},
        "description": {"en": "Merge multiple inputs", "de": "Mehrere Eingaben zusammenführen", "fr": "Fusionner plusieurs entrées"},
        "parameters": [
            {"name": "mode", "type": "string", "required": False, "description": {"en": "append | combine", "de": "Modus", "fr": "Mode"}},
        ],
        "inputs": 2,
        "outputs": 1,
        "executor": "flow",
        "meta": {"icon": "mdi-merge", "color": "#FF9800"},
    },
    {
        "id": "flow.loop",
        "category": "flow",
        "label": {"en": "Loop / For Each", "de": "Schleife / Für Jedes", "fr": "Boucle / Pour Chaque"},
        "description": {"en": "Iterate over array items", "de": "Über Array-Elemente iterieren", "fr": "Itérer sur les éléments"},
        "parameters": [
            {"name": "items", "type": "string", "required": True, "description": {"en": "Path to array (e.g. {{input.items}})", "de": "Pfad zum Array", "fr": "Chemin vers le tableau"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "executor": "flow",
        "meta": {"icon": "mdi-repeat", "color": "#FF9800"},
    },
    {
        "id": "flow.wait",
        "category": "flow",
        "label": {"en": "Wait / Delay", "de": "Warten / Verzögerung", "fr": "Attendre / Délai"},
        "description": {"en": "Pause for duration", "de": "Pause für Dauer", "fr": "Pause pour durée"},
        "parameters": [
            {"name": "seconds", "type": "number", "required": True, "description": {"en": "Seconds to wait", "de": "Sekunden", "fr": "Secondes"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "executor": "flow",
        "meta": {"icon": "mdi-timer", "color": "#FF9800"},
    },
    {
        "id": "flow.stop",
        "category": "flow",
        "label": {"en": "Stop / Terminate", "de": "Stopp / Beenden", "fr": "Arrêter / Terminer"},
        "description": {"en": "Stop workflow execution", "de": "Workflow-Ausführung beenden", "fr": "Arrêter l'exécution"},
        "parameters": [],
        "inputs": 1,
        "outputs": 0,
        "executor": "flow",
        "meta": {"icon": "mdi-stop", "color": "#F44336"},
    },
]
