# Copyright (c) 2025 Patrick Motsch
# Canvas start nodes — variant reflects workflow configuration (gear in editor).

from modules.shared.i18nRegistry import t

TRIGGER_NODES = [
    {
        "id": "trigger.manual",
        "category": "trigger",
        "label": t("Start"),
        "description": t("Manuell, API oder Hintergrund-Starts (Webhook, E-Mail, …)."),
        "parameters": [],
        "inputs": 0,
        "outputs": 1,
        "inputPorts": {},
        "outputPorts": {0: {"schema": "ActionResult"}},
        "executor": "trigger",
        "meta": {"icon": "mdi-play", "color": "#4CAF50"},
    },
    {
        "id": "trigger.form",
        "category": "trigger",
        "label": t("Start (Formular)"),
        "description": t("Felder werden beim Start befüllt; konfigurieren Sie die Felder auf dieser Node."),
        "parameters": [
            {
                "name": "formFields",
                "type": "json",
                "required": False,
                "frontendType": "fieldBuilder",
                "description": t("Felddefinitionen"),
            },
        ],
        "inputs": 0,
        "outputs": 1,
        "inputPorts": {},
        "outputPorts": {0: {"schema": "FormPayload", "dynamic": True, "deriveFrom": "formFields"}},
        "executor": "trigger",
        "meta": {"icon": "mdi-form-select", "color": "#9C27B0"},
    },
    {
        "id": "trigger.schedule",
        "category": "trigger",
        "label": t("Start (Zeitplan)"),
        "description": t("Cron-Ausdruck für geplante Läufe."),
        "parameters": [
            {
                "name": "cron",
                "type": "string",
                "required": False,
                "frontendType": "cron",
                "description": t("Cron-Ausdruck"),
            },
        ],
        "inputs": 0,
        "outputs": 1,
        "inputPorts": {},
        "outputPorts": {0: {"schema": "ActionResult"}},
        "executor": "trigger",
        "meta": {"icon": "mdi-clock", "color": "#2196F3"},
    },
]
