# Copyright (c) 2025 Patrick Motsch
# Input/Human node definitions - nodes that require user action.

from modules.shared.i18nRegistry import t

INPUT_NODES = [
    {
        "id": "input.form",
        "category": "input",
        "label": t("Formular"),
        "description": t("Benutzer füllt ein Formular aus"),
        "parameters": [
            {
                "name": "fields",
                "type": "json",
                "required": True,
                "frontendType": "fieldBuilder",
                "description": t("Formularfelder"),
                "default": [],
            },
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "FormPayload", "dynamic": True, "deriveFrom": "fields"}},
        "executor": "input",
        "meta": {"icon": "mdi-form-textbox", "color": "#9C27B0"},
    },
    {
        "id": "input.approval",
        "category": "input",
        "label": t("Genehmigung"),
        "description": t("Benutzer genehmigt oder lehnt ab"),
        "parameters": [
            {"name": "title", "type": "string", "required": True, "frontendType": "text",
             "description": t("Genehmigungstitel")},
            {"name": "description", "type": "string", "required": False, "frontendType": "textarea",
             "description": t("Was genehmigt werden soll")},
            {"name": "approvalType", "type": "string", "required": False, "frontendType": "select",
             "frontendOptions": {"options": ["generic", "document"]},
             "description": t("Typ: document oder generic"), "default": "generic"},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "BoolResult"}},
        "executor": "input",
        "meta": {"icon": "mdi-check-decagram", "color": "#4CAF50"},
    },
    {
        "id": "input.upload",
        "category": "input",
        "label": t("Upload"),
        "description": t("Benutzer lädt Datei(en) hoch"),
        "parameters": [
            {"name": "accept", "type": "string", "required": False, "frontendType": "text",
             "description": t("Accept-String"), "default": ""},
            {"name": "allowedTypes", "type": "json", "required": False, "frontendType": "multiselect",
             "frontendOptions": {"options": ["pdf", "docx", "xlsx", "pptx", "txt", "csv", "jpg", "png", "gif"]},
             "description": t("Ausgewählte Dateitypen"), "default": []},
            {"name": "maxSize", "type": "number", "required": False, "frontendType": "number",
             "description": t("Max. Dateigröße in MB"), "default": 10},
            {"name": "multiple", "type": "boolean", "required": False, "frontendType": "checkbox",
             "description": t("Mehrere Dateien erlauben"), "default": False},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "DocumentList"}},
        "executor": "input",
        "meta": {"icon": "mdi-upload", "color": "#2196F3"},
    },
    {
        "id": "input.comment",
        "category": "input",
        "label": t("Kommentar"),
        "description": t("Benutzer fügt einen Kommentar hinzu"),
        "parameters": [
            {"name": "placeholder", "type": "string", "required": False, "frontendType": "text",
             "description": t("Platzhalter"), "default": ""},
            {"name": "required", "type": "boolean", "required": False, "frontendType": "checkbox",
             "description": t("Kommentar erforderlich"), "default": True},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "TextResult"}},
        "executor": "input",
        "meta": {"icon": "mdi-comment-text", "color": "#FF9800"},
    },
    {
        "id": "input.review",
        "category": "input",
        "label": t("Prüfung"),
        "description": t("Benutzer prüft Inhalt"),
        "parameters": [
            {"name": "contentRef", "type": "string", "required": True, "frontendType": "text",
             "description": t("Referenz auf Inhalt")},
            {"name": "reviewType", "type": "string", "required": False, "frontendType": "select",
             "frontendOptions": {"options": ["generic", "document"]},
             "description": t("Art der Prüfung"), "default": "generic"},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "BoolResult"}},
        "executor": "input",
        "meta": {"icon": "mdi-magnify-scan", "color": "#673AB7"},
    },
    {
        "id": "input.selection",
        "category": "input",
        "label": t("Auswahl"),
        "description": t("Benutzer wählt aus Optionen"),
        "parameters": [
            {"name": "options", "type": "json", "required": True, "frontendType": "keyValueRows",
             "description": t("Optionen"), "default": []},
            {"name": "multiple", "type": "boolean", "required": False, "frontendType": "checkbox",
             "description": t("Mehrfachauswahl erlauben"), "default": False},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "TextResult"}},
        "executor": "input",
        "meta": {"icon": "mdi-format-list-checks", "color": "#009688"},
    },
    {
        "id": "input.confirmation",
        "category": "input",
        "label": t("Bestätigung"),
        "description": t("Benutzer bestätigt Ja/Nein"),
        "parameters": [
            {"name": "question", "type": "string", "required": True, "frontendType": "text",
             "description": t("Zu bestätigende Frage")},
            {"name": "confirmLabel", "type": "string", "required": False, "frontendType": "text",
             "description": t("Label für Bestätigen-Button"), "default": "Confirm"},
            {"name": "rejectLabel", "type": "string", "required": False, "frontendType": "text",
             "description": t("Label für Ablehnen-Button"), "default": "Reject"},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["Transit"]}},
        "outputPorts": {0: {"schema": "BoolResult"}},
        "executor": "input",
        "meta": {"icon": "mdi-checkbox-marked-circle", "color": "#8BC34A"},
    },
]
