{
  "name": "FASE 2 - Publicador PROD",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [
        -600,
        0
      ]
    },
    {
      "parameters": {
        "amount": "={{ Math.floor(Math.random() * 600) + 120 }}"
      },
      "name": "Delay Humano",
      "type": "n8n-nodes-base.wait",
      "position": [
        -400,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "={{ $json.modo }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "test"
            }
          ]
        }
      },
      "name": "IF Test",
      "type": "n8n-nodes-base.if",
      "position": [
        -200,
        0
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "estado",
              "value": "publicado"
            },
            {
              "name": "post_id",
              "value": "MOCK_{{$now}}"
            }
          ]
        }
      },
      "name": "Mock",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        -150
      ]
    },
    {
      "parameters": {
        "mode": "rules",
        "rules": {
          "values": [
            {
              "conditions": {
                "conditions": [
                  {
                    "leftValue": "={{ $json.tipo }}",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "rightValue": "imagen"
                  }
                ]
              },
              "outputKey": "imagen"
            },
            {
              "conditions": {
                "conditions": [
                  {
                    "leftValue": "={{ $json.tipo }}",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "rightValue": "reel"
                  }
                ]
              },
              "outputKey": "reel"
            }
          ]
        }
      },
      "name": "Switch Tipo",
      "type": "n8n-nodes-base.switch",
      "position": [
        0,
        100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://graph.facebook.com/v19.0/IG_ID/media",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "image_url",
              "value": "={{ $json.media_url }}"
            },
            {
              "name": "caption",
              "value": "={{ $json.caption }}"
            },
            {
              "name": "access_token",
              "value": "REEMPLAZAR_TOKEN"
            }
          ]
        }
      },
      "name": "Crear Contenedor Imagen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        200,
        0
      ]
    },
    {
      "parameters": {
        "amount": 15
      },
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        400,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://graph.facebook.com/v19.0/IG_ID/media_publish",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $json.id }}"
            },
            {
              "name": "access_token",
              "value": "REEMPLAZAR_TOKEN"
            }
          ]
        }
      },
      "name": "Publicar Imagen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        600,
        0
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Delay Humano"
          }
        ]
      ]
    },
    "Delay Humano": {
      "main": [
        [
          {
            "node": "IF Test"
          }
        ]
      ]
    },
    "IF Test": {
      "main": [
        [
          {
            "node": "Mock"
          }
        ],
        [
          {
            "node": "Switch Tipo"
          }
        ]
      ]
    },
    "Switch Tipo": {
      "main": [
        [
          {
            "node": "Crear Contenedor Imagen"
          }
        ],
        [
          {
            "node": "Crear Contenedor Imagen"
          }
        ]
      ]
    },
    "Crear Contenedor Imagen": {
      "main": [
        [
          {
            "node": "Wait"
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Publicar Imagen"
          }
        ]
      ]
    }
  }
}