# Copyright (c) 2025 Patrick Motsch
# SharePoint node definitions - map to methodSharepoint actions.
# Use connectionId and path from connection selector (like workflow folder view).

SHAREPOINT_NODES = [
    {
        "id": "sharepoint.findFile",
        "category": "sharepoint",
        "label": {"en": "Find File", "de": "Datei finden", "fr": "Trouver fichier"},
        "description": {"en": "Find file by path or search", "de": "Datei nach Pfad oder Suche finden", "fr": "Trouver fichier par chemin ou recherche"},
        "parameters": [
            {"name": "connectionId", "type": "string", "required": True, "description": {"en": "SharePoint connection", "de": "SharePoint-Verbindung", "fr": "Connexion SharePoint"}},
            {"name": "searchQuery", "type": "string", "required": True, "description": {"en": "Search query or path", "de": "Suchanfrage oder Pfad", "fr": "Requête ou chemin"}},
            {"name": "site", "type": "string", "required": False, "description": {"en": "Optional site hint", "de": "Optionaler Site-Hinweis", "fr": "Indication de site"}, "default": ""},
            {"name": "maxResults", "type": "number", "required": False, "description": {"en": "Max results", "de": "Max Ergebnisse", "fr": "Max résultats"}, "default": 1000},
        ],
        "inputs": 1,
        "outputs": 1,
        "meta": {"icon": "mdi-file-search", "color": "#0078D4"},
        "_method": "sharepoint",
        "_action": "findDocumentPath",
        "_paramMap": {"connectionId": "connectionReference", "searchQuery": "searchQuery", "site": "site", "maxResults": "maxResults"},
    },
    {
        "id": "sharepoint.readFile",
        "category": "sharepoint",
        "label": {"en": "Read File", "de": "Datei lesen", "fr": "Lire fichier"},
        "description": {"en": "Extract content from file", "de": "Inhalt aus Datei extrahieren", "fr": "Extraire le contenu du fichier"},
        "parameters": [
            {"name": "connectionId", "type": "string", "required": True, "description": {"en": "SharePoint connection", "de": "SharePoint-Verbindung", "fr": "Connexion SharePoint"}},
            {"name": "path", "type": "string", "required": True, "description": {"en": "File path or documentList from find file", "de": "Dateipfad oder documentList von Find", "fr": "Chemin ou documentList"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "meta": {"icon": "mdi-file-document", "color": "#0078D4"},
        "_method": "sharepoint",
        "_action": "readDocuments",
        "_paramMap": {"connectionId": "connectionReference", "path": "pathQuery"},
    },
    {
        "id": "sharepoint.uploadFile",
        "category": "sharepoint",
        "label": {"en": "Upload File", "de": "Datei hochladen", "fr": "Téléverser fichier"},
        "description": {"en": "Upload file to SharePoint", "de": "Datei zu SharePoint hochladen", "fr": "Téléverser fichier vers SharePoint"},
        "parameters": [
            {"name": "connectionId", "type": "string", "required": True, "description": {"en": "SharePoint connection", "de": "SharePoint-Verbindung", "fr": "Connexion SharePoint"}},
            {"name": "path", "type": "string", "required": True, "description": {"en": "Target folder path (e.g. /sites/.../Folder)", "de": "Zielordner-Pfad", "fr": "Chemin du dossier cible"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "meta": {"icon": "mdi-upload", "color": "#0078D4"},
        "_method": "sharepoint",
        "_action": "uploadFile",
        "_paramMap": {"connectionId": "connectionReference", "path": "pathQuery"},
    },
    {
        "id": "sharepoint.listFiles",
        "category": "sharepoint",
        "label": {"en": "List Files", "de": "Dateien auflisten", "fr": "Lister fichiers"},
        "description": {"en": "List files in folder or SharePoint", "de": "Dateien in Ordner oder SharePoint auflisten", "fr": "Lister les fichiers dans un dossier"},
        "parameters": [
            {"name": "connectionId", "type": "string", "required": True, "description": {"en": "SharePoint connection", "de": "SharePoint-Verbindung", "fr": "Connexion SharePoint"}},
            {"name": "path", "type": "string", "required": False, "description": {"en": "Folder path (e.g. /sites/SiteName/Shared Documents)", "de": "Ordnerpfad", "fr": "Chemin du dossier"}, "default": "/"},
        ],
        "inputs": 1,
        "outputs": 1,
        "meta": {"icon": "mdi-folder-open", "color": "#0078D4"},
        "_method": "sharepoint",
        "_action": "listDocuments",
        "_paramMap": {"connectionId": "connectionReference", "path": "pathQuery"},
    },
    {
        "id": "sharepoint.downloadFile",
        "category": "sharepoint",
        "label": {"en": "Download File", "de": "Datei herunterladen", "fr": "Télécharger fichier"},
        "description": {"en": "Download file from path (e.g. /sites/SiteName/Shared Documents/file.pdf)", "de": "Datei vom Pfad herunterladen", "fr": "Télécharger le fichier"},
        "parameters": [
            {"name": "connectionId", "type": "string", "required": True, "description": {"en": "SharePoint connection", "de": "SharePoint-Verbindung", "fr": "Connexion SharePoint"}},
            {"name": "path", "type": "string", "required": True, "description": {"en": "Full file path (e.g. /sites/SiteName/Shared Documents/file.pdf)", "de": "Vollständiger Dateipfad", "fr": "Chemin complet du fichier"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "meta": {"icon": "mdi-download", "color": "#0078D4"},
        "_method": "sharepoint",
        "_action": "downloadFileByPath",
        "_paramMap": {"connectionId": "connectionReference", "path": "pathQuery", "siteId": "siteId", "filePath": "filePath"},
    },
    {
        "id": "sharepoint.copyFile",
        "category": "sharepoint",
        "label": {"en": "Copy File", "de": "Datei kopieren", "fr": "Copier fichier"},
        "description": {"en": "Copy file to destination", "de": "Datei an Ziel kopieren", "fr": "Copier le fichier"},
        "parameters": [
            {"name": "connectionId", "type": "string", "required": True, "description": {"en": "SharePoint connection", "de": "SharePoint-Verbindung", "fr": "Connexion SharePoint"}},
            {"name": "sourcePath", "type": "string", "required": True, "description": {"en": "Source file path (from browse)", "de": "Quelldatei-Pfad", "fr": "Chemin fichier source"}},
            {"name": "destPath", "type": "string", "required": True, "description": {"en": "Destination folder path (from browse)", "de": "Zielordner-Pfad", "fr": "Chemin dossier cible"}},
        ],
        "inputs": 1,
        "outputs": 1,
        "meta": {"icon": "mdi-content-copy", "color": "#0078D4"},
        "_method": "sharepoint",
        "_action": "copyFile",
        "_paramMap": {"connectionId": "connectionReference", "sourcePath": "sourcePath", "destPath": "destPath"},
    },
]
