{
  "name": "FASE 1 - Motor Logica",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -600,
        0
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": "REEMPLAZAR_SHEET_ID",
        "sheetName": "Calendario"
      },
      "name": "Get Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -400,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "={{ $json.estado }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "pendiente"
            }
          ]
        }
      },
      "name": "IF Estado",
      "type": "n8n-nodes-base.if",
      "position": [
        -200,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "={{ new Date($json.fecha_hora) }}",
              "rightValue": "={{ new Date() }}",
              "operator": {
                "type": "dateTime",
                "operation": "beforeOrEquals"
              }
            }
          ]
        }
      },
      "name": "IF Fecha",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "batchSize": 1
      },
      "name": "Split In Batches",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        200,
        0
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "modo",
              "value": "test"
            }
          ]
        }
      },
      "name": "Set Modo",
      "type": "n8n-nodes-base.set",
      "position": [
        350,
        0
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "tipo",
              "value": "={{ $json.tipo }}"
            },
            {
              "name": "caption",
              "value": "={{ $json.caption }}"
            },
            {
              "name": "media_url",
              "value": "={{ $json.media_url }}"
            },
            {
              "name": "hashtags",
              "value": "={{ $json.hashtags }}"
            },
            {
              "name": "plataforma",
              "value": "={{ $json.plataforma }}"
            },
            {
              "name": "row_number",
              "value": "={{ $json.row_number }}"
            },
            {
              "name": "modo",
              "value": "={{ $json.modo }}"
            }
          ]
        }
      },
      "name": "Build Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        0
      ]
    },
    {
      "parameters": {
        "workflowId": "REEMPLAZAR_WORKFLOW_ID_PUBLICADOR",
        "options": {}
      },
      "name": "Execute Publicador",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        700,
        0
      ]
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Sheet"
          }
        ]
      ]
    },
    "Get Sheet": {
      "main": [
        [
          {
            "node": "IF Estado"
          }
        ]
      ]
    },
    "IF Estado": {
      "main": [
        [
          {
            "node": "IF Fecha"
          }
        ]
      ]
    },
    "IF Fecha": {
      "main": [
        [
          {
            "node": "Split In Batches"
          }
        ]
      ]
    },
    "Split In Batches": {
      "main": [
        [
          {
            "node": "Set Modo"
          }
        ]
      ]
    },
    "Set Modo": {
      "main": [
        [
          {
            "node": "Build Payload"
          }
        ]
      ]
    },
    "Build Payload": {
      "main": [
        [
          {
            "node": "Execute Publicador"
          }
        ]
      ]
    }
  }
}