# Copyright (c) 2025 Patrick Motsch
# File node definitions - create files from context (e.g. from AI nodes).

from modules.shared.i18nRegistry import t

FILE_NODES = [
    {
        "id": "file.create",
        "category": "file",
        "label": t("Datei erstellen"),
        "description": t("Erstellt eine Datei aus Kontext (Text/Markdown von KI)."),
        "parameters": [
            {"name": "contentSources", "type": "json", "required": False, "frontendType": "json",
             "description": t("Kontext-Quellen"), "default": []},
            {"name": "outputFormat", "type": "string", "required": True, "frontendType": "select",
             "frontendOptions": {"options": ["docx", "pdf", "txt", "html", "md"]},
             "description": t("Ausgabeformat"), "default": "docx"},
            {"name": "title", "type": "string", "required": False, "frontendType": "text",
             "description": t("Dokumenttitel")},
            {"name": "templateName", "type": "string", "required": False, "frontendType": "select",
             "frontendOptions": {"options": ["default", "corporate", "minimal"]},
             "description": t("Stil-Vorlage")},
            {"name": "language", "type": "string", "required": False, "frontendType": "select",
             "frontendOptions": {"options": ["de", "en", "fr"]},
             "description": t("Sprache"), "default": "de"},
            {"name": "context", "type": "string", "required": False, "frontendType": "hidden",
             "description": t("Inhalt (via Wire oder DataRef)"), "default": ""},
        ],
        "inputs": 1,
        "outputs": 1,
        "inputPorts": {0: {"accepts": ["AiResult", "TextResult", "Transit"]}},
        "outputPorts": {0: {"schema": "DocumentList"}},
        "meta": {"icon": "mdi-file-plus-outline", "color": "#2196F3"},
        "_method": "file",
        "_action": "create",
    },
]
