{
  "info": {
    "_postman_id": "5e0f8055-7ad3-4dda-b0d6-2654e9673e4a",
    "name": "N-Agent Collections",
    "description": "# Z-Agent Collections\nColecao completa do Z-Agent: gateway universal que expoe SQL e APIs REST configuraveis por JSON.\n\nFluxo: `POST /database` -> `POST /command` -> `POST /router` -> chamar a rota.\nRotas nativas exigem `Authorization: Bearer <token>` (token ausente/invalido responde **400**).\nVeja o README.md na raiz para o passo a passo e a ordem de execucao.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{zagent_token}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "00 - Reset e Preparacao",
      "item": [
        {
          "name": "Reset do ambiente de testes",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/status",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "status"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Usa `axios` dentro do pre-request para listar e remover recursos `zt-*`. O resultado fica na variavel `reset_removed`."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Remove tudo que a colecao cria (prefixo zt-) e a database ORACLE_TESTES.",
                  "const base = pm.variables.replaceIn(\"{{z_agent_url}}\");",
                  "const token = pm.variables.replaceIn(\"{{zagent_token}}\");",
                  "const send = (method, path) => new Promise((resolve) => {",
                  "  pm.sendRequest({ url: base + path, method, header: { Authorization: \"Bearer \" + token } },",
                  "    (err, r) => resolve(err ? { code: 0, json: () => null } : r));",
                  "});",
                  "const list = async (p) => {",
                  "  const r = await send(\"GET\", p);",
                  "  if (r.code !== 200) return [];",
                  "  try { const j = r.json(); return Array.isArray(j) ? j : []; } catch (e) { return []; }",
                  "};",
                  "(async () => {",
                  "  const removed = { routers: 0, commands: 0, certificates: 0, databases: 0 };",
                  "  for (const r of await list(\"/router\")) if (String(r.key).startsWith(\"zt-\")) { await send(\"DELETE\", \"/router?key=\" + encodeURIComponent(r.key)); removed.routers++; }",
                  "  for (const c of await list(\"/command\")) if (String(c.key).startsWith(\"zt-\")) { await send(\"DELETE\", \"/command?key=\" + encodeURIComponent(c.key)); removed.commands++; }",
                  "  for (const c of await list(\"/certificate\")) if (String(c.name).startsWith(\"zt-\")) { await send(\"DELETE\", \"/certificate/\" + c.id); removed.certificates++; }",
                  "  const d = await send(\"DELETE\", \"/database?key=ORACLE_TESTES\");",
                  "  if (d.code === 204) removed.databases++;",
                  "  pm.collectionVariables.set(\"reset_removed\", JSON.stringify(removed));",
                  "})();",
                  ""
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"z-agent no ar\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().status).to.equal(\"UP\");",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Remove tudo que a colecao cria (commands/routers com prefixo `zt-`, certificados `zt-*` e a database ORACLE_TESTES), deixando a colecao reexecutavel."
    },
    {
      "name": "01 - Status e Metricas",
      "item": [
        {
          "name": "GET status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/status",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "status"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Health check. Devolve `status` (variavel STATUS), `version` (header `X-App-Version`) e o ping (timeout 3s) de cada database cadastrada: `connected`/`disconnected`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 UP\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().status).to.equal(\"UP\");",
                  "});",
                  "",
                  "test(\"expoe versao no header e no body\", function () {",
                  "  expect(res.getHeader(\"x-app-version\")).to.be.a(\"string\");",
                  "  expect(res.getBody().version).to.be.a(\"string\");",
                  "});",
                  "",
                  "test(\"lista databases\", function () {",
                  "  expect(res.getBody().databases).to.be.an(\"array\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "GET metrics (Prometheus)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/metrics",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "metrics"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Metricas Prometheus: `http_requests_total`, `http_request_duration_seconds`, `http_request_size_bytes`, `http_response_size_bytes`, `database_connections_total`, `database_queries_total`, `app_info`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 text/plain com metricas\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(String(res.getBody())).to.include(\"http_requests_total\");",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Endpoints abertos (sem token)."
    },
    {
      "name": "02 - Database",
      "item": [
        {
          "name": "Cadastrar database ORACLE_TESTES",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/database",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"ORACLE_TESTES\",\n  \"driver\": \"oracle\",\n  \"host\": \"{{oracle_host}}\",\n  \"port\": {{oracle_port}},\n  \"database\": \"{{oracle_service}}\",\n  \"user\": \"{{oracle_user}}\",\n  \"password\": \"{{oracle_password}}\",\n  \"pool\": {\n    \"maxOpenConns\": 10,\n    \"maxIdleConns\": 2\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Schema Z_AGENT_TESTES (suprimentos). `driver`: oracle | postgres | mysql | sqlserver. A senha vem de `{{process.env.ORACLE_TESTES_PASSWORD}}`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 criada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"ORACLE_TESTES\");",
                  "});",
                  "",
                  "test(\"senha nunca e devolvida\", function () {",
                  "  expect(res.getBody().password).to.be.undefined;",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Cadastrar database duplicada (erro)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/database",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"ORACLE_TESTES\",\n  \"driver\": \"oracle\",\n  \"host\": \"{{oracle_host}}\",\n  \"port\": {{oracle_port}},\n  \"database\": \"{{oracle_service}}\",\n  \"user\": \"{{oracle_user}}\",\n  \"password\": \"{{oracle_password}}\",\n  \"pool\": {\n    \"maxOpenConns\": 10,\n    \"maxIdleConns\": 2\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "A `key` e unica."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 chave ja existe\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar databases",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/database",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 com a database\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().map(d => d.key)).to.include(\"ORACLE_TESTES\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar database por key (query)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/database?key=ORACLE_TESTES",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ],
              "query": [
                {
                  "key": "key",
                  "value": "ORACLE_TESTES"
                }
              ]
            },
            "description": "Filtros: `?key=` ou `?id=`. Guarda o `id` na variavel `db_id`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "const b = res.getBody(); const d = Array.isArray(b) ? b[0] : b; if (d && d.id) bru.setVar(\"db_id\", d.id);",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar database por ID (path)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/database/{{db_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database",
                "{{db_id}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 mesma key\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().key).to.equal(\"ORACLE_TESTES\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Verificar conexao via status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/status",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "status"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"ORACLE_TESTES connected\", function () {",
                  "  const d = res.getBody().databases.find(x => x.key === \"ORACLE_TESTES\");",
                  "  expect(d).to.exist;",
                  "  expect(d.status).to.equal(\"connected\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Erro - driver invalido",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/database",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-driver-invalido\",\n  \"driver\": \"cobol\",\n  \"host\": \"x\",\n  \"port\": 1,\n  \"database\": \"x\",\n  \"user\": \"x\",\n  \"password\": \"x\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Drivers validos: oracle, postgres, mysql, sqlserver."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Erro - sem token",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/database",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Comportamento real do Z-Agent: token ausente responde **400**, nao 401."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 (nao 401)\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  expect(res.getBody().message).to.include(\"Authorization\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Erro - token invalido",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer token-errado",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/database",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "database"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Conexoes com bancos externos. O pool e aberto no cadastro (timeout 3s) e persistido no BoltDB. Oracle: o host do servidor precisa ser o IP (10.17.91.99) pois o DNS interno nao resolve la."
    },
    {
      "name": "03 - Commands SQL (Suprimentos)",
      "item": [
        {
          "name": "01 - Query",
          "item": [
            {
              "name": "zt-produtos-listar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produtos-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, CODIGO, DESCRICAO, CATEGORIA, UNIDADE, CONTROLA_LOTE, PRECO_CUSTO, ATIVO FROM PRODUTO WHERE (:CODIGO IS NULL OR CODIGO = :CODIGO) AND (:CATEGORIA IS NULL OR CATEGORIA = :CATEGORIA) AND (:ATIVO IS NULL OR ATIVO = :ATIVO) AND (:DESCRICAO IS NULL OR DESCRICAO LIKE :DESCRICAO)\",\n  \"parameters\": [\n    {\n      \"name\": \"CODIGO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"CATEGORIA\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"ATIVO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"DESCRICAO\",\n      \"type\": \"string\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"DESCRICAO\",\n    \"desc\": false\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Filtros opcionais no padrao null-safe `(:X IS NULL OR COLUNA = :X)`. `DESCRICAO` usa LIKE (envie `%dipirona%`). Ordenado por DESCRICAO."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produtos-listar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-produto-buscar-id",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produto-buscar-id\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, CODIGO, DESCRICAO, CATEGORIA, UNIDADE, CONTROLA_LOTE, PRECO_CUSTO, ATIVO FROM PRODUTO WHERE ID = :ID\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produto-buscar-id\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-produto-buscar-codigo",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produto-buscar-codigo\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, CODIGO, DESCRICAO, CATEGORIA, UNIDADE, CONTROLA_LOTE, PRECO_CUSTO, ATIVO FROM PRODUTO WHERE CODIGO = :CODIGO\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produto-buscar-codigo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-estoque-listar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-estoque-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT e.ID, p.CODIGO, p.DESCRICAO, e.ALMOXARIFADO, e.LOCALIZACAO, e.QTD_MINIMA, e.QTD_MAXIMA, e.PONTO_REPOSICAO FROM ESTOQUE e JOIN PRODUTO p ON p.ID = e.ID_PRODUTO WHERE (:ALMOXARIFADO IS NULL OR e.ALMOXARIFADO = :ALMOXARIFADO) AND (:ID_PRODUTO IS NULL OR e.ID_PRODUTO = :ID_PRODUTO)\",\n  \"parameters\": [\n    {\n      \"name\": \"ALMOXARIFADO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"ID_PRODUTO\",\n      \"type\": \"number\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"p.DESCRICAO\",\n    \"desc\": false\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "JOIN + filtros opcionais null-safe (ALMOXARIFADO, ID_PRODUTO)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-estoque-listar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-saldo-listar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-saldo-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT * FROM VW_SALDO_PRODUTO WHERE (:ALMOXARIFADO IS NULL OR ALMOXARIFADO = :ALMOXARIFADO) AND (:SITUACAO IS NULL OR SITUACAO = :SITUACAO) AND (:CATEGORIA IS NULL OR CATEGORIA = :CATEGORIA)\",\n  \"parameters\": [\n    {\n      \"name\": \"ALMOXARIFADO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"SITUACAO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"CATEGORIA\",\n      \"type\": \"string\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"SALDO_TOTAL\",\n    \"desc\": false\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Consulta a view VW_SALDO_PRODUTO (saldo total por produto/almoxarifado e situacao OK/REPOR/ABAIXO_MINIMO)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-saldo-listar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-saldo-resumo-categoria",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-saldo-resumo-categoria\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT p.CATEGORIA, COUNT(DISTINCT p.ID) AS QTD_PRODUTOS, SUM(l.SALDO) AS SALDO_TOTAL FROM PRODUTO p JOIN ESTOQUE e ON e.ID_PRODUTO = p.ID JOIN LOTE_SALDO l ON l.ID_ESTOQUE = e.ID GROUP BY p.CATEGORIA\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Agregacao com GROUP BY (sem parametros, portanto sem filtros anexados)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-saldo-resumo-categoria\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-lotes-por-produto",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-lotes-por-produto\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT l.ID AS ID_LOTE, p.ID AS ID_PRODUTO, p.CODIGO, p.DESCRICAO, e.ALMOXARIFADO, l.LOTE, l.DT_VALIDADE, l.SALDO FROM LOTE_SALDO l JOIN ESTOQUE e ON e.ID = l.ID_ESTOQUE JOIN PRODUTO p ON p.ID = e.ID_PRODUTO WHERE p.ID = :ID_PRODUTO AND (:ALMOXARIFADO IS NULL OR e.ALMOXARIFADO = :ALMOXARIFADO)\",\n  \"parameters\": [\n    {\n      \"name\": \"ID_PRODUTO\",\n      \"type\": \"number\",\n      \"required\": true\n    },\n    {\n      \"name\": \"ALMOXARIFADO\",\n      \"type\": \"string\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"l.DT_VALIDADE\",\n    \"desc\": false\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "`ID_PRODUTO` obrigatorio; `ALMOXARIFADO` opcional (null-safe)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-lotes-por-produto\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-lotes-vencendo",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-lotes-vencendo\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT l.ID AS ID_LOTE, p.CODIGO, p.DESCRICAO, e.ALMOXARIFADO, l.LOTE, l.DT_VALIDADE, l.SALDO FROM LOTE_SALDO l JOIN ESTOQUE e ON e.ID = l.ID_ESTOQUE JOIN PRODUTO p ON p.ID = e.ID_PRODUTO WHERE l.SALDO > 0 AND l.DT_VALIDADE <= ADD_MONTHS(TRUNC(SYSDATE), :MESES)\",\n  \"parameters\": [\n    {\n      \"name\": \"MESES\",\n      \"type\": \"number\",\n      \"required\": true\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"l.DT_VALIDADE\",\n    \"desc\": false\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Lotes com saldo que vencem em ate N meses."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-lotes-vencendo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-pacientes-listar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-pacientes-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, PRONTUARIO, NOME, CPF, DT_NASCIMENTO, SEXO, CONVENIO, LEITO, ATIVO FROM PACIENTE WHERE (:CONVENIO IS NULL OR CONVENIO = :CONVENIO) AND (:SEXO IS NULL OR SEXO = :SEXO) AND (:ATIVO IS NULL OR ATIVO = :ATIVO) AND (:NOME IS NULL OR NOME LIKE :NOME)\",\n  \"parameters\": [\n    {\n      \"name\": \"CONVENIO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"SEXO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"ATIVO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"NOME\",\n      \"type\": \"string\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"NOME\",\n    \"desc\": false\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-pacientes-listar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-buscar-id",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-buscar-id\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, PRONTUARIO, NOME, CPF, DT_NASCIMENTO, SEXO, CONVENIO, LEITO, ATIVO FROM PACIENTE WHERE ID = :ID\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-buscar-id\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-ficha",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-ficha\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, PRONTUARIO, NOME, CONVENIO, LEITO FROM PACIENTE WHERE ID = :ID_PACIENTE\",\n  \"parameters\": [\n    {\n      \"name\": \"ID_PACIENTE\",\n      \"type\": \"number\",\n      \"required\": true\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Mesmo parametro (`ID_PACIENTE`) do resumo de consumo, para as rotas multi-step compartilharem o path param."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-ficha\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-buscar-prontuario",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-buscar-prontuario\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, PRONTUARIO, NOME, CPF, DT_NASCIMENTO, SEXO, CONVENIO, LEITO, ATIVO FROM PACIENTE WHERE PRONTUARIO = :PRONTUARIO\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-buscar-prontuario\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-movimentos-listar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-movimentos-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, TIPO, ID_LOTE_SALDO, QUANTIDADE, ID_PACIENTE, DOCUMENTO, USUARIO, DT_MOVIMENTO FROM MOVIMENTO WHERE (:TIPO IS NULL OR TIPO = :TIPO) AND (:ID_PACIENTE IS NULL OR ID_PACIENTE = :ID_PACIENTE) AND (:ID_LOTE_SALDO IS NULL OR ID_LOTE_SALDO = :ID_LOTE_SALDO) AND (:DOCUMENTO IS NULL OR DOCUMENTO = :DOCUMENTO)\",\n  \"parameters\": [\n    {\n      \"name\": \"TIPO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"ID_PACIENTE\",\n      \"type\": \"number\"\n    },\n    {\n      \"name\": \"ID_LOTE_SALDO\",\n      \"type\": \"number\"\n    },\n    {\n      \"name\": \"DOCUMENTO\",\n      \"type\": \"string\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"ID\",\n    \"desc\": true\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Movimentos (E = entrada, S = saida) com filtros opcionais null-safe, mais recentes primeiro."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-movimentos-listar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-consumo-paciente",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-consumo-paciente\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT * FROM VW_CONSUMO_PACIENTE WHERE ID_PACIENTE = :ID_PACIENTE\",\n  \"parameters\": [\n    {\n      \"name\": \"ID_PACIENTE\",\n      \"type\": \"number\",\n      \"required\": true\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"ID_MOVIMENTO\",\n    \"desc\": true\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Consumo (saidas) de um paciente, via view VW_CONSUMO_PACIENTE."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-consumo-paciente\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-consumo-resumo-paciente",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-consumo-resumo-paciente\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID_PACIENTE, PACIENTE, COUNT(*) AS QTD_MOVIMENTOS, SUM(QUANTIDADE) AS TOTAL_ITENS FROM VW_CONSUMO_PACIENTE WHERE ID_PACIENTE = :ID_PACIENTE GROUP BY ID_PACIENTE, PACIENTE\",\n  \"parameters\": [\n    {\n      \"name\": \"ID_PACIENTE\",\n      \"type\": \"number\",\n      \"required\": true\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-consumo-resumo-paciente\");",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "Executor QUERY: SELECT. Devolve lista de objetos (ou 1 objeto com `single-result`). Colunas Oracle chegam em MAIUSCULAS."
        },
        {
          "name": "02 - Insert",
          "item": [
            {
              "name": "zt-produto-inserir",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produto-inserir\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"INSERT\",\n  \"sql\": \"INSERT INTO PRODUTO (CODIGO, DESCRICAO, CATEGORIA, UNIDADE, CONTROLA_LOTE, PRECO_CUSTO) VALUES (:CODIGO, :DESCRICAO, :CATEGORIA, :UNIDADE, :CONTROLA_LOTE, :PRECO_CUSTO)\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produto-inserir\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-inserir",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-inserir\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"INSERT\",\n  \"sql\": \"INSERT INTO PACIENTE (PRONTUARIO, NOME, CPF, DT_NASCIMENTO, SEXO, CONVENIO, LEITO) VALUES (:PRONTUARIO, :NOME, :CPF, TO_DATE(:DT_NASCIMENTO, 'YYYY-MM-DD'), :SEXO, :CONVENIO, :LEITO)\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-inserir\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-estoque-inserir",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-estoque-inserir\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"INSERT\",\n  \"sql\": \"INSERT INTO ESTOQUE (ID_PRODUTO, ALMOXARIFADO, LOCALIZACAO, QTD_MINIMA, QTD_MAXIMA, PONTO_REPOSICAO) VALUES (:ID_PRODUTO, :ALMOXARIFADO, :LOCALIZACAO, :QTD_MINIMA, :QTD_MAXIMA, :PONTO_REPOSICAO)\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-estoque-inserir\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-lote-inserir",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-lote-inserir\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"INSERT\",\n  \"sql\": \"INSERT INTO LOTE_SALDO (ID_ESTOQUE, LOTE, DT_VALIDADE, SALDO) VALUES (:ID_ESTOQUE, :LOTE, TO_DATE(:DT_VALIDADE, 'YYYY-MM-DD'), 0)\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-lote-inserir\");",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "Executor INSERT: devolve linhas afetadas. Parametros vem do body JSON (e/ou path/query). Datas: use TO_DATE(:X, 'YYYY-MM-DD')."
        },
        {
          "name": "03 - Update",
          "item": [
            {
              "name": "zt-produto-atualizar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produto-atualizar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"UPDATE\",\n  \"sql\": \"UPDATE PRODUTO SET DESCRICAO = :DESCRICAO, PRECO_CUSTO = :PRECO_CUSTO WHERE ID = :ID\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produto-atualizar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-produto-inativar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produto-inativar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"UPDATE\",\n  \"sql\": \"UPDATE PRODUTO SET ATIVO = 'N' WHERE ID = :ID\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produto-inativar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-leito",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-leito\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"UPDATE\",\n  \"sql\": \"UPDATE PACIENTE SET LEITO = :LEITO WHERE ID = :ID\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-leito\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-estoque-parametros",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-estoque-parametros\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"UPDATE\",\n  \"sql\": \"UPDATE ESTOQUE SET QTD_MINIMA = :QTD_MINIMA, PONTO_REPOSICAO = :PONTO_REPOSICAO WHERE ID = :ID\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-estoque-parametros\");",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "Executor UPDATE: exige WHERE com valores reais (SQLValidator). Devolve linhas afetadas."
        },
        {
          "name": "04 - Delete",
          "item": [
            {
              "name": "zt-produto-deletar-codigo",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-produto-deletar-codigo\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"DELETE\",\n  \"sql\": \"DELETE FROM PRODUTO WHERE CODIGO = :CODIGO\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-produto-deletar-codigo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-deletar-prontuario",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-deletar-prontuario\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"DELETE\",\n  \"sql\": \"DELETE FROM PACIENTE WHERE PRONTUARIO = :PRONTUARIO\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-deletar-prontuario\");",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "Executor DELETE: exige WHERE com valores reais. Respeita as FKs do schema (paciente/produto com movimentos nao podem ser removidos)."
        },
        {
          "name": "05 - Procedure e Anonymous",
          "item": [
            {
              "name": "zt-movimento-registrar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-movimento-registrar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"PROCEDURE\",\n  \"sql\": \"BEGIN PRC_MOVIMENTO_JSON(:P_TIPO, :P_ID_LOTE_SALDO, :P_QUANTIDADE, :P_ID_PACIENTE, :P_DOCUMENTO, :P_RESULTADO); END;\",\n  \"parameters\": [\n    {\n      \"name\": \"P_TIPO\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"name\": \"P_ID_LOTE_SALDO\",\n      \"type\": \"number\",\n      \"required\": true\n    },\n    {\n      \"name\": \"P_QUANTIDADE\",\n      \"type\": \"number\",\n      \"required\": true\n    },\n    {\n      \"name\": \"P_ID_PACIENTE\",\n      \"type\": \"number\",\n      \"required\": true\n    },\n    {\n      \"name\": \"P_DOCUMENTO\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"name\": \"P_RESULTADO\",\n      \"type\": \"string\",\n      \"time\": \"out\"\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Registra entrada (E) ou saida (S) atualizando LOTE_SALDO. Saida exige paciente e saldo suficiente (ORA-20005 -> HTTP 400). Retorna `{idMovimento, saldoAtual, tipo, mensagem}`. ATENCAO: o Z-Agent envia parametro AUSENTE ao Oracle como bytes vazios (RAW), o que da PLS-00306 em parametro NUMBER; por isso `P_ID_PACIENTE` e obrigatorio e `0` significa \"sem paciente\" (a entrada o ignora e a saida com 0 e rejeitada)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-movimento-registrar\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-paciente-excluir",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-paciente-excluir\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"PROCEDURE\",\n  \"sql\": \"BEGIN PRC_EXCLUI_PACIENTE(:P_ID_PACIENTE, :P_RESULTADO); END;\",\n  \"parameters\": [\n    {\n      \"name\": \"P_ID_PACIENTE\",\n      \"type\": \"number\",\n      \"required\": true\n    },\n    {\n      \"name\": \"P_RESULTADO\",\n      \"type\": \"string\",\n      \"time\": \"out\"\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Exclui um paciente de teste ESTORNANDO o consumo: devolve ao saldo dos lotes as saidas do paciente, apaga os movimentos e o paciente. Protegido: so prontuarios TST* (ORA-20010 para a carga inicial)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-paciente-excluir\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-anonimo-total-saldo",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-anonimo-total-saldo\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"ANONYMOUS\",\n  \"sql\": \"BEGIN SELECT '{\\\"totalSaldo\\\":' || NVL(SUM(SALDO), 0) || ',\\\"lotes\\\":' || COUNT(*) || '}' INTO :RESULTADO FROM LOTE_SALDO; END;\",\n  \"parameters\": [\n    {\n      \"name\": \"RESULTADO\",\n      \"type\": \"string\",\n      \"time\": \"out\"\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Bloco anonimo com OUT em JSON. Timeout padrao do ANONYMOUS: 300s."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-anonimo-total-saldo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-anonimo-reajustar-preco",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-anonimo-reajustar-preco\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"ANONYMOUS\",\n  \"sql\": \"BEGIN UPDATE PRODUTO SET PRECO_CUSTO = ROUND(PRECO_CUSTO * (1 + :PERCENTUAL / 100), 4) WHERE CODIGO = :CODIGO; :RESULTADO := '{\\\"linhas\\\":' || SQL%ROWCOUNT || '}'; END;\",\n  \"parameters\": [\n    {\n      \"name\": \"PERCENTUAL\",\n      \"type\": \"number\",\n      \"required\": true\n    },\n    {\n      \"name\": \"CODIGO\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"name\": \"RESULTADO\",\n      \"type\": \"string\",\n      \"time\": \"out\"\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "DML dentro de bloco anonimo (reajuste percentual de um produto) devolvendo as linhas afetadas."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 command criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().key).to.equal(\"zt-anonimo-reajustar-preco\");",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "PROCEDURE/ANONYMOUS (Oracle): parametros OUT marcados com `\"time\": \"out\"`. Apenas o PRIMEIRO OUT nao vazio e devolvido; se for JSON valido vira objeto, senao texto. Por isso as procedures devolvem um unico OUT em JSON."
        }
      ],
      "description": "Commands do schema Z_AGENT_TESTES (PRODUTO, ESTOQUE, LOTE_SALDO, PACIENTE, MOVIMENTO + views e procedures).\n\nRegras importantes:\n- Parametros `:NOME` referenciados no SQL sao marcados `required` automaticamente.\n- **QUERY + filtros opcionais (Oracle)**: o Z-Agent sabe anexar `WHERE/AND COLUNA op :COLUNA` para parametros que nao estao no SQL, MAS o driver Oracle (godror) rejeita binds que nao aparecem no SQL (\"sql: expected N arguments, got M\") e o executor envia todos os parametros declarados. Por isso, em Oracle, filtro opcional deve ficar NO SQL no padrao null-safe: `(:X IS NULL OR COLUNA = :X)` (parametro declarado sem `required`). Funciona com `=`, `LIKE`, numeros e datas.\n- **INSERT/UPDATE/DELETE** passam pelo SQLValidator (UPDATE/DELETE exigem WHERE).\n- **PROCEDURE/ANONYMOUS** devolvem apenas o primeiro parametro OUT (`time: out`), como JSON ou texto."
    },
    {
      "name": "04 - Routers SQL (Suprimentos)",
      "item": [
        {
          "name": "zt-r-produtos-listar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produtos-listar\",\n  \"path\": \"/api/suprimentos/produtos\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-produtos-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Filtros via query: CODIGO, CATEGORIA, ATIVO, DESCRICAO (LIKE)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produtos-listar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-produto-id",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produto-id\",\n  \"path\": \"/api/suprimentos/produtos/{ID}\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-produto-buscar-id\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "`single-result: true` -> objeto."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produto-id\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-produto-codigo",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produto-codigo\",\n  \"path\": \"/api/suprimentos/produtos/codigo/{CODIGO}\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-produto-buscar-codigo\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produto-codigo\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-produto-criar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produto-criar\",\n  \"path\": \"/api/suprimentos/produtos\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 201,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"INSERT\",\n          \"return-result\": false,\n          \"name\": \"zt-produto-inserir\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Body JSON com CODIGO, DESCRICAO, CATEGORIA, UNIDADE, CONTROLA_LOTE, PRECO_CUSTO."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produto-criar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-produto-atualizar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produto-atualizar\",\n  \"path\": \"/api/suprimentos/produtos/{ID}\",\n  \"method\": \"PUT\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"UPDATE\",\n          \"return-result\": false,\n          \"name\": \"zt-produto-atualizar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "ID no path; DESCRICAO e PRECO_CUSTO no body."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produto-atualizar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-produto-inativar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produto-inativar\",\n  \"path\": \"/api/suprimentos/produtos/{ID}/inativar\",\n  \"method\": \"PUT\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"UPDATE\",\n          \"return-result\": false,\n          \"name\": \"zt-produto-inativar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produto-inativar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-produto-deletar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produto-deletar\",\n  \"path\": \"/api/suprimentos/produtos/codigo/{CODIGO}\",\n  \"method\": \"DELETE\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"DELETE\",\n          \"return-result\": false,\n          \"name\": \"zt-produto-deletar-codigo\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-produto-deletar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-estoque-listar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-estoque-listar\",\n  \"path\": \"/api/suprimentos/estoque\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-estoque-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-estoque-listar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-estoque-criar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-estoque-criar\",\n  \"path\": \"/api/suprimentos/estoque\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 201,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"INSERT\",\n          \"return-result\": false,\n          \"name\": \"zt-estoque-inserir\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-estoque-criar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-estoque-parametros",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-estoque-parametros\",\n  \"path\": \"/api/suprimentos/estoque/{ID}/parametros\",\n  \"method\": \"PUT\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"UPDATE\",\n          \"return-result\": false,\n          \"name\": \"zt-estoque-parametros\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-estoque-parametros\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-saldo-listar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-saldo-listar\",\n  \"path\": \"/api/suprimentos/saldo\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-saldo-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-saldo-listar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-saldo-resumo",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-saldo-resumo\",\n  \"path\": \"/api/suprimentos/saldo/resumo-categoria\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-saldo-resumo-categoria\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-saldo-resumo\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-lotes-listar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-lotes-listar\",\n  \"path\": \"/api/suprimentos/lotes\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-lotes-por-produto\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "`?ID_PRODUTO=` obrigatorio; `?ALMOXARIFADO=` opcional."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-lotes-listar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-lotes-vencendo",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-lotes-vencendo\",\n  \"path\": \"/api/suprimentos/lotes/vencendo\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-lotes-vencendo\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "`?MESES=` obrigatorio."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-lotes-vencendo\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-lote-criar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-lote-criar\",\n  \"path\": \"/api/suprimentos/lotes\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 201,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"INSERT\",\n          \"return-result\": false,\n          \"name\": \"zt-lote-inserir\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-lote-criar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-pacientes-listar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-pacientes-listar\",\n  \"path\": \"/api/suprimentos/pacientes\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-pacientes-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-pacientes-listar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-paciente-id",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-paciente-id\",\n  \"path\": \"/api/suprimentos/pacientes/{ID}\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-paciente-buscar-id\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-paciente-id\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-paciente-prontuario",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-paciente-prontuario\",\n  \"path\": \"/api/suprimentos/pacientes/prontuario/{PRONTUARIO}\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-paciente-buscar-prontuario\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-paciente-prontuario\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-paciente-criar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-paciente-criar\",\n  \"path\": \"/api/suprimentos/pacientes\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 201,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"INSERT\",\n          \"return-result\": false,\n          \"name\": \"zt-paciente-inserir\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-paciente-criar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-paciente-leito",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-paciente-leito\",\n  \"path\": \"/api/suprimentos/pacientes/{ID}/leito\",\n  \"method\": \"PUT\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"UPDATE\",\n          \"return-result\": false,\n          \"name\": \"zt-paciente-leito\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-paciente-leito\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-paciente-deletar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-paciente-deletar\",\n  \"path\": \"/api/suprimentos/pacientes/prontuario/{PRONTUARIO}\",\n  \"method\": \"DELETE\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"DELETE\",\n          \"return-result\": false,\n          \"name\": \"zt-paciente-deletar-prontuario\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-paciente-deletar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-movimentos-listar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-movimentos-listar\",\n  \"path\": \"/api/suprimentos/movimentos\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-movimentos-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-movimentos-listar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-movimento-registrar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-movimento-registrar\",\n  \"path\": \"/api/suprimentos/movimentos\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 201,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"PROCEDURE\",\n          \"return-result\": true,\n          \"name\": \"zt-movimento-registrar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Body: P_TIPO (E|S), P_ID_LOTE_SALDO, P_QUANTIDADE, P_ID_PACIENTE (0 na entrada), P_DOCUMENTO."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-movimento-registrar\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-consumo-paciente",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-consumo-paciente\",\n  \"path\": \"/api/suprimentos/pacientes/{ID_PACIENTE}/consumo\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-consumo-paciente\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-consumo-paciente\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-consumo-resumo",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-consumo-resumo\",\n  \"path\": \"/api/suprimentos/pacientes/{ID_PACIENTE}/consumo/resumo\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-consumo-resumo-paciente\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-consumo-resumo\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-paciente-excluir",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-paciente-excluir\",\n  \"path\": \"/api/suprimentos/pacientes/{P_ID_PACIENTE}\",\n  \"method\": \"DELETE\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"PROCEDURE\",\n          \"return-result\": true,\n          \"name\": \"zt-paciente-excluir\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "PROCEDURE com estorno de saldo. Retorna `{pacienteRemovido, movimentosEstornados, unidadesDevolvidas}`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-paciente-excluir\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-anonimo-total",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-anonimo-total\",\n  \"path\": \"/api/suprimentos/anonimo/total-saldo\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"ANONYMOUS\",\n          \"return-result\": true,\n          \"name\": \"zt-anonimo-total-saldo\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-anonimo-total\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-anonimo-reajuste",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-anonimo-reajuste\",\n  \"path\": \"/api/suprimentos/anonimo/reajuste/{CODIGO}\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"ANONYMOUS\",\n          \"return-result\": true,\n          \"name\": \"zt-anonimo-reajustar-preco\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "`?PERCENTUAL=10` na query e CODIGO no path."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-anonimo-reajuste\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-ficha-paciente",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-ficha-paciente\",\n  \"path\": \"/api/suprimentos/pacientes/{ID_PACIENTE}/ficha\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-paciente-ficha\",\n          \"database\": \"ORACLE_TESTES\"\n        },\n        \"alias\": \"paciente\"\n      },\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-consumo-resumo-paciente\",\n          \"database\": \"ORACLE_TESTES\"\n        },\n        \"alias\": \"consumo\"\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "Multi-step sequencial: os dois steps leem o MESMO path param `ID_PACIENTE`. Com `single-result: true` cada step devolve 1 objeto e o Z-Agent mescla os resultados (o 2o alias entra dentro do objeto do 1o)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-ficha-paciente\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-dashboard",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-dashboard\",\n  \"path\": \"/api/suprimentos/dashboard\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": false,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-saldo-resumo-categoria\",\n          \"database\": \"ORACLE_TESTES\"\n        },\n        \"alias\": \"saldo\"\n      },\n      {\n        \"command\": {\n          \"type\": \"ANONYMOUS\",\n          \"return-result\": true,\n          \"name\": \"zt-anonimo-total-saldo\",\n          \"database\": \"ORACLE_TESTES\"\n        },\n        \"alias\": \"total\"\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "`single-thread: false`: steps em paralelo; a resposta e um ARRAY com os resultados na ordem de termino."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-dashboard\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "zt-r-timeout-curto",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-timeout-curto\",\n  \"path\": \"/api/suprimentos/lento\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-produtos-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  },\n  \"x-request-timeout-ms\": 1\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "`x-request-timeout-ms: 1` na rota -> estoura quase sempre (504). Prioridade: header X-Request-Timeout-Ms > rota > DEFAULT_REQUEST_TIMEOUT_MS > DEFAULT_TIMEOUT."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"201 rota registrada\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().key).to.equal(\"zt-r-timeout-curto\");",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Rotas dinamicas `/api/suprimentos/...`. Cada rota mapeia METODO + PATH -> steps -> commands.\n- Path params (`{ID}`) e query string viram parametros com o MESMO nome (case sensitive).\n- `response.status` e o status de sucesso. INSERT/UPDATE/DELETE devolvem corpo vazio (so o status).\n- `single-result: true` devolve o primeiro registro como objeto em vez de array."
    },
    {
      "name": "05 - Testes das Rotas (Suprimentos)",
      "item": [
        {
          "name": "01 - Produtos",
          "item": [
            {
              "name": "Listar produtos",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200 com a carga inicial\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody()).to.be.an(\"array\");",
                      "  expect(res.getBody().length).to.be.at.least(20);",
                      "});",
                      "",
                      "test(\"colunas Oracle em maiusculas\", function () {",
                      "  expect(res.getBody()[0]).to.have.property(\"CODIGO\");",
                      "  expect(res.getBody()[0]).to.have.property(\"DESCRICAO\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar produtos - filtro CATEGORIA",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos?CATEGORIA=EPI",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos"
                  ],
                  "query": [
                    {
                      "key": "CATEGORIA",
                      "value": "EPI"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Filtro dinamico: `WHERE CATEGORIA = :CATEGORIA` anexado ao SQL."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"so EPI\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.equal(2);",
                      "  expect(res.getBody().every(p => p.CATEGORIA === \"EPI\")).to.equal(true);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar produtos - filtro LIKE descricao",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos?DESCRICAO=%SORO%",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos"
                  ],
                  "query": [
                    {
                      "key": "DESCRICAO",
                      "value": "%SORO%"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Operador LIKE configurado no parametro."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"soros\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.be.at.least(2);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar produtos - dois filtros",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos?CATEGORIA=MEDICAMENTO&ATIVO=S",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos"
                  ],
                  "query": [
                    {
                      "key": "CATEGORIA",
                      "value": "MEDICAMENTO"
                    },
                    {
                      "key": "ATIVO",
                      "value": "S"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Filtros combinados com AND."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"medicamentos ativos\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.equal(8);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Buscar produto por ID",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "1"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "`single-result: true` devolve objeto."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"objeto unico\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody()).to.be.an(\"object\");",
                      "  expect(res.getBody().CODIGO).to.be.a(\"string\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Criar produto",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"CODIGO\": \"{{zt_codigo}}\",\n  \"DESCRICAO\": \"PRODUTO DE TESTE Z-AGENT\",\n  \"CATEGORIA\": \"MATERIAL HOSPITALAR\",\n  \"UNIDADE\": \"UN\",\n  \"CONTROLA_LOTE\": \"S\",\n  \"PRECO_CUSTO\": 12.5\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "INSERT devolve corpo vazio, so o status 201. O codigo e gerado no pre-request (`zt_codigo`)."
              },
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "bru.setVar(\"zt_codigo\", \"TST\" + String(Date.now()).slice(-8));"
                    ]
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 criado\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Criar produto duplicado (erro)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"CODIGO\": \"{{zt_codigo}}\",\n  \"DESCRICAO\": \"DUPLICADO\",\n  \"CATEGORIA\": \"EPI\",\n  \"UNIDADE\": \"UN\",\n  \"CONTROLA_LOTE\": \"S\",\n  \"PRECO_CUSTO\": 1\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "A constraint UK_PRODUTO_CODIGO do Oracle e propagada como 400."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"400 ORA-00001 (unique)\", function () {",
                      "  expect(res.getStatus()).to.equal(400);",
                      "  expect(res.getBody().message).to.include(\"ORA-00001\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Buscar produto criado por codigo",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/codigo/{{zt_codigo}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "codigo",
                    "{{zt_codigo}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Guarda o ID em `zt_produto_id`."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "const b = res.getBody(); if (b && b.ID !== undefined) bru.setVar(\"zt_produto_id\", String(b.ID));",
                      "test(\"encontrado\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().DESCRICAO).to.equal(\"PRODUTO DE TESTE Z-AGENT\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Atualizar produto",
              "request": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/{{zt_produto_id}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "{{zt_produto_id}}"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"DESCRICAO\": \"PRODUTO DE TESTE ATUALIZADO\",\n  \"PRECO_CUSTO\": 15.75\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Confirmar atualizacao",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/{{zt_produto_id}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "{{zt_produto_id}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"descricao atualizada\", function () {",
                      "  expect(res.getBody().DESCRICAO).to.equal(\"PRODUTO DE TESTE ATUALIZADO\");",
                      "  expect(Number(res.getBody().PRECO_CUSTO)).to.equal(15.75);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Inativar produto",
              "request": {
                "method": "PUT",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/{{zt_produto_id}}/inativar",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "{{zt_produto_id}}",
                    "inativar"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "UPDATE com literal no SQL (`SET ATIVO = 'N'`)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Confirmar inativacao",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/codigo/{{zt_codigo}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "codigo",
                    "{{zt_codigo}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"ATIVO = N\", function () {",
                      "  expect(res.getBody().ATIVO).to.equal(\"N\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Reajustar preco (ANONYMOUS)",
              "request": {
                "method": "POST",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/anonimo/reajuste/{{zt_codigo}}?PERCENTUAL=10",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "anonimo",
                    "reajuste",
                    "{{zt_codigo}}"
                  ],
                  "query": [
                    {
                      "key": "PERCENTUAL",
                      "value": "10"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Bloco anonimo PL/SQL com UPDATE e `SQL%ROWCOUNT`."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"1 linha afetada\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().linhas).to.equal(1);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Confirmar reajuste",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/{{zt_produto_id}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "{{zt_produto_id}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"15.75 + 10% = 17.325\", function () {",
                      "  expect(Number(res.getBody().PRECO_CUSTO)).to.be.closeTo(17.325, 0.0001);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Deletar produto",
              "request": {
                "method": "DELETE",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/codigo/{{zt_codigo}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "codigo",
                    "{{zt_codigo}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Confirmar remocao",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/produtos/codigo/{{zt_codigo}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "produtos",
                    "codigo",
                    "{{zt_codigo}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Consulta sem resultado nao vira 404: o Z-Agent responde com o status configurado e corpo vazio."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"sem registro (corpo vazio)\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody() === '' || res.getBody() === null || res.getBody() === undefined).to.equal(true);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ]
        },
        {
          "name": "02 - Estoque e Saldo",
          "item": [
            {
              "name": "Listar estoque",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/estoque",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "estoque"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"30 linhas\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.be.at.least(30);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar estoque - ALMOXARIFADO GERAL",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/estoque?ALMOXARIFADO=ALMOXARIFADO GERAL",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "estoque"
                  ],
                  "query": [
                    {
                      "key": "ALMOXARIFADO",
                      "value": "ALMOXARIFADO GERAL"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"10 produtos\", function () {",
                      "  expect(res.getBody().length).to.equal(10);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Saldo por produto (view)",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/saldo",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "saldo"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"saldo e situacao\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody()[0]).to.have.property(\"SALDO_TOTAL\");",
                      "  expect(res.getBody()[0]).to.have.property(\"SITUACAO\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Saldo - somente REPOR",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/saldo?SITUACAO=REPOR",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "saldo"
                  ],
                  "query": [
                    {
                      "key": "SITUACAO",
                      "value": "REPOR"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"filtrado\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().every(r => r.SITUACAO === \"REPOR\")).to.equal(true);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Resumo por categoria (GROUP BY)",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/saldo/resumo-categoria",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "saldo",
                    "resumo-categoria"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"4 categorias\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.equal(4);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Lotes de um produto",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/lotes?ID_PRODUTO=1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "lotes"
                  ],
                  "query": [
                    {
                      "key": "ID_PRODUTO",
                      "value": "1"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Guarda o 1o lote em `zt_lote_id` / `zt_lote_saldo` para os testes de movimento."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "const b = res.getBody(); if (Array.isArray(b) && b.length) { bru.setVar(\"zt_lote_id\", String(b[0].ID_LOTE)); bru.setVar(\"zt_lote_saldo\", String(b[0].SALDO)); }",
                      "test(\"lotes do produto 1\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.be.at.least(1);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Lotes - sem ID_PRODUTO (erro)",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/lotes",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "lotes"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "`ID_PRODUTO` esta no SQL, portanto e obrigatorio."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"400 parametro obrigatorio\", function () {",
                      "  expect(res.getStatus()).to.equal(400);",
                      "  expect(res.getBody().message).to.include(\"ID_PRODUTO\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Lotes vencendo em 12 meses",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/lotes/vencendo?MESES=12",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "lotes",
                    "vencendo"
                  ],
                  "query": [
                    {
                      "key": "MESES",
                      "value": "12"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200 ou 200 vazio\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ]
        },
        {
          "name": "03 - Pacientes",
          "item": [
            {
              "name": "Listar pacientes",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"15 pacientes\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.be.at.least(15);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar pacientes - convenio UNIMED",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes?CONVENIO=UNIMED",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes"
                  ],
                  "query": [
                    {
                      "key": "CONVENIO",
                      "value": "UNIMED"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"filtrado\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().every(p => p.CONVENIO === \"UNIMED\")).to.equal(true);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Buscar paciente por ID",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "1"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"objeto\", function () {",
                      "  expect(res.getBody().PRONTUARIO).to.equal(\"PRT0001\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Buscar paciente por prontuario",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/prontuario/PRT0003",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "prontuario",
                    "PRT0003"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"objeto\", function () {",
                      "  expect(res.getBody().NOME).to.equal(\"ANA BEATRIZ OLIVEIRA\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Criar paciente",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"PRONTUARIO\": \"{{zt_prontuario}}\",\n  \"NOME\": \"PACIENTE DE TESTE\",\n  \"CPF\": \"{{zt_cpf}}\",\n  \"DT_NASCIMENTO\": \"1990-05-20\",\n  \"SEXO\": \"F\",\n  \"CONVENIO\": \"SUS\",\n  \"LEITO\": \"ENF-999\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "A data vai como texto `YYYY-MM-DD` e e convertida no SQL com `TO_DATE`."
              },
              "event": [
                {
                  "listen": "prerequest",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "bru.setVar(\"zt_prontuario\", \"TST\" + String(Date.now()).slice(-8)); bru.setVar(\"zt_cpf\", String(Date.now()).slice(-11));"
                    ]
                  }
                },
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Buscar paciente criado",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/prontuario/{{zt_prontuario}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "prontuario",
                    "{{zt_prontuario}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "const b = res.getBody(); if (b && b.ID !== undefined) bru.setVar(\"zt_paciente_id\", String(b.ID));",
                      "test(\"encontrado\", function () {",
                      "  expect(res.getBody().LEITO).to.equal(\"ENF-999\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Trocar leito",
              "request": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/{{zt_paciente_id}}/leito",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "{{zt_paciente_id}}",
                    "leito"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"LEITO\": \"UTI-09\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Confirmar leito",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/{{zt_paciente_id}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "{{zt_paciente_id}}"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"UTI-09\", function () {",
                      "  expect(res.getBody().LEITO).to.equal(\"UTI-09\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Consumo do paciente novo (vazio)",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/{{zt_paciente_id}}/consumo",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "{{zt_paciente_id}}",
                    "consumo"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"sem consumo\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody() === '' || res.getBody() === null || res.getBody() === undefined).to.equal(true);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ]
        },
        {
          "name": "04 - Movimentos (entrada e saida)",
          "item": [
            {
              "name": "Preparar - saldo do lote antes",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/lotes?ID_PRODUTO=1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "lotes"
                  ],
                  "query": [
                    {
                      "key": "ID_PRODUTO",
                      "value": "1"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "const l = res.getBody()[0]; bru.setVar(\"zt_lote_id\", String(l.ID_LOTE)); bru.setVar(\"zt_saldo_antes\", String(l.SALDO));",
                      "test(\"tem saldo\", function () {",
                      "  expect(Number(bru.getVar(\"zt_saldo_antes\"))).to.be.above(5);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Saida para paciente (baixa saldo)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/movimentos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "movimentos"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"P_TIPO\": \"S\",\n  \"P_ID_LOTE_SALDO\": {{zt_lote_id}},\n  \"P_QUANTIDADE\": 3,\n  \"P_ID_PACIENTE\": {{zt_paciente_id}},\n  \"P_DOCUMENTO\": \"REQ-TESTE\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "PROCEDURE Oracle: o unico OUT (`P_RESULTADO`) e um JSON, devolvido como objeto."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "const b = res.getBody(); if (b && b.idMovimento) bru.setVar(\"zt_mov_id\", String(b.idMovimento));",
                      "test(\"201 e saldo reduzido em 3\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().tipo).to.equal(\"S\");",
                      "  expect(res.getBody().mensagem).to.equal(\"OK\");",
                      "  expect(Number(res.getBody().saldoAtual)).to.equal(Number(bru.getVar(\"zt_saldo_antes\")) - 3);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Conferir saldo apos saida",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/lotes?ID_PRODUTO=1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "lotes"
                  ],
                  "query": [
                    {
                      "key": "ID_PRODUTO",
                      "value": "1"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"saldo do lote = antes - 3\", function () {",
                      "  const l = res.getBody().find(x => String(x.ID_LOTE) === bru.getVar(\"zt_lote_id\"));",
                      "  expect(Number(l.SALDO)).to.equal(Number(bru.getVar(\"zt_saldo_antes\")) - 3);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Consumo do paciente",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/{{zt_paciente_id}}/consumo",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "{{zt_paciente_id}}",
                    "consumo"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"1 consumo de 3 unidades\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.equal(1);",
                      "  expect(Number(res.getBody()[0].QUANTIDADE)).to.equal(3);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Resumo de consumo do paciente",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/{{zt_paciente_id}}/consumo/resumo",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "{{zt_paciente_id}}",
                    "consumo",
                    "resumo"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"agregado\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(Number(res.getBody().TOTAL_ITENS)).to.equal(3);",
                      "  expect(Number(res.getBody().QTD_MOVIMENTOS)).to.equal(1);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Saida com saldo insuficiente (erro)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/movimentos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "movimentos"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"P_TIPO\": \"S\",\n  \"P_ID_LOTE_SALDO\": {{zt_lote_id}},\n  \"P_QUANTIDADE\": 999999,\n  \"P_ID_PACIENTE\": {{zt_paciente_id}},\n  \"P_DOCUMENTO\": \"REQ-INSUF\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "RAISE_APPLICATION_ERROR da procedure vira HTTP 400 com a mensagem do Oracle."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"400 ORA-20005\", function () {",
                      "  expect(res.getStatus()).to.equal(400);",
                      "  expect(res.getBody().message).to.include(\"ORA-20005\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Saida sem paciente (erro)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/movimentos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "movimentos"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"P_TIPO\": \"S\",\n  \"P_ID_LOTE_SALDO\": {{zt_lote_id}},\n  \"P_QUANTIDADE\": 1,\n  \"P_ID_PACIENTE\": 0,\n  \"P_DOCUMENTO\": \"REQ-SEMPAC\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "`P_ID_PACIENTE: 0` = sem paciente; a procedure rejeita a saida (ORA-20003)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"400 ORA-20003\", function () {",
                      "  expect(res.getStatus()).to.equal(400);",
                      "  expect(res.getBody().message).to.include(\"ORA-20003\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Entrada (repoe saldo)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/movimentos",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "movimentos"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"P_TIPO\": \"E\",\n  \"P_ID_LOTE_SALDO\": {{zt_lote_id}},\n  \"P_QUANTIDADE\": 5,\n  \"P_ID_PACIENTE\": 0,\n  \"P_DOCUMENTO\": \"NF-TESTE\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Entrada nao tem paciente: envie `P_ID_PACIENTE: 0` (obrigatorio no command; a procedure o ignora na entrada)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 e saldo = antes - 3 + 5\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().tipo).to.equal(\"E\");",
                      "  expect(Number(res.getBody().saldoAtual)).to.equal(Number(bru.getVar(\"zt_saldo_antes\")) + 2);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar movimentos do paciente",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/movimentos?ID_PACIENTE={{zt_paciente_id}}",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "movimentos"
                  ],
                  "query": [
                    {
                      "key": "ID_PACIENTE",
                      "value": "{{zt_paciente_id}}"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"1 saida\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.equal(1);",
                      "  expect(res.getBody()[0].TIPO).to.equal(\"S\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Listar entradas (filtro TIPO)",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/movimentos?TIPO=E",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "movimentos"
                  ],
                  "query": [
                    {
                      "key": "TIPO",
                      "value": "E"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"so entradas\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().every(m => m.TIPO === \"E\")).to.equal(true);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "Fluxo logico de suprimentos: saida para paciente baixa o saldo do lote; entrada repoe. Tudo passa pela PROCEDURE e mantem LOTE_SALDO consistente com MOVIMENTO."
        },
        {
          "name": "05 - Anonymous e Multi-step",
          "item": [
            {
              "name": "Anonymous - total do saldo",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/anonimo/total-saldo",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "anonimo",
                    "total-saldo"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"JSON do bloco\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(Number(res.getBody().totalSaldo)).to.be.above(0);",
                      "  expect(Number(res.getBody().lotes)).to.be.at.least(58);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Multi-step sequencial - ficha do paciente",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/pacientes/1/ficha",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "pacientes",
                    "1",
                    "ficha"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Step 1 (alias `paciente`) e step 2 (alias `consumo`) leem o mesmo path param `ID_PACIENTE`. Formato real (single-result true): `{ paciente: { ...campos do paciente, consumo: { ... } } }` - o alias do 2o step entra DENTRO do objeto do 1o."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200 e dados dos dois steps mesclados\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().paciente.PRONTUARIO).to.equal(\"PRT0001\");",
                      "  expect(Number(res.getBody().paciente.consumo.TOTAL_ITENS)).to.be.above(0);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Multi-step paralelo - dashboard",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{z_agent_url}}/api/suprimentos/dashboard",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "suprimentos",
                    "dashboard"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "`single-thread: false` executa os steps em goroutines; a ordem do array e a de termino."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"array com os resultados dos dois steps\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody()).to.be.an(\"array\");",
                      "  expect(res.getBody().length).to.equal(2);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ],
          "description": "ANONYMOUS, rotas com varios steps (sequencial com `extract`) e paralelas (`single-thread: false`)."
        }
      ],
      "description": "Chamadas as rotas dinamicas (sem Bearer). Cada fluxo cria seus proprios dados (codigos/prontuarios unicos) e limpa no final, entao e reexecutavel."
    },
    {
      "name": "06 - APIs Externas (HTTP)",
      "item": [
        {
          "name": "01 - Commands",
          "item": [
            {
              "name": "zt-ext-cep-get",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-cep-get\",\n  \"type\": \"GET\",\n  \"route\": \"{{viacep_url}}/{CEP}/json/\",\n  \"query\": {\n    \"fields\": [\n      {\n        \"name\": \"CEP\",\n        \"type\": \"string\",\n        \"required\": true,\n        \"paramType\": \"QUERY\"\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "GET com path param `{CEP}`."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-posts-listar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-posts-listar\",\n  \"type\": \"GET\",\n  \"route\": \"{{jsonplaceholder_url}}/posts\",\n  \"query\": {\n    \"fields\": [\n      {\n        \"name\": \"userId\",\n        \"type\": \"string\",\n        \"required\": false,\n        \"paramType\": \"QUERY\"\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "GET com query string opcional."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-post-criar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-post-criar\",\n  \"type\": \"POST\",\n  \"route\": \"{{jsonplaceholder_url}}/posts\",\n  \"contentType\": \"application/json\",\n  \"body\": {\n    \"fields\": [\n      {\n        \"name\": \"title\",\n        \"type\": \"string\",\n        \"required\": true,\n        \"minimum\": 3,\n        \"maximum\": 100\n      },\n      {\n        \"name\": \"body\",\n        \"type\": \"string\",\n        \"required\": true\n      },\n      {\n        \"name\": \"userId\",\n        \"type\": \"number\",\n        \"required\": true,\n        \"minimum\": 1\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "POST JSON com validacao de body (required, tipo, minimum/maximum)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-post-atualizar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-post-atualizar\",\n  \"type\": \"PUT\",\n  \"route\": \"{{jsonplaceholder_url}}/posts/{id}\",\n  \"query\": {\n    \"fields\": [\n      {\n        \"name\": \"id\",\n        \"type\": \"string\",\n        \"required\": true,\n        \"paramType\": \"QUERY\"\n      }\n    ]\n  },\n  \"body\": {\n    \"fields\": [\n      {\n        \"name\": \"title\",\n        \"type\": \"string\",\n        \"required\": true\n      },\n      {\n        \"name\": \"body\",\n        \"type\": \"string\",\n        \"required\": true\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "PUT com path param + body."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-post-remover",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-post-remover\",\n  \"type\": \"REMOVE\",\n  \"route\": \"{{jsonplaceholder_url}}/posts/{id}\",\n  \"query\": {\n    \"fields\": [\n      {\n        \"name\": \"id\",\n        \"type\": \"string\",\n        \"required\": true,\n        \"paramType\": \"QUERY\"\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "REMOVE = DELETE HTTP."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-form-urlencoded",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-form-urlencoded\",\n  \"type\": \"POST\",\n  \"route\": \"{{httpbin_url}}/post\",\n  \"contentType\": \"application/x-www-form-urlencoded\",\n  \"body\": {\n    \"fields\": [\n      {\n        \"name\": \"usuario\",\n        \"type\": \"string\",\n        \"required\": true\n      },\n      {\n        \"name\": \"perfil\",\n        \"type\": \"string\",\n        \"required\": true\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "POST application/x-www-form-urlencoded (httpbin ecoa o que recebe)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-multipart",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-multipart\",\n  \"type\": \"POST\",\n  \"route\": \"{{httpbin_url}}/post\",\n  \"contentType\": \"multipart/form-data\",\n  \"body\": {\n    \"fields\": [\n      {\n        \"name\": \"descricao\",\n        \"type\": \"string\",\n        \"required\": true\n      },\n      {\n        \"name\": \"arquivo\",\n        \"type\": \"byte\",\n        \"required\": true\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "POST multipart/form-data com upload de arquivo (campo `byte`)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-download-png",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-download-png\",\n  \"type\": \"GET\",\n  \"route\": \"{{httpbin_url}}/image/png\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "Resposta binaria (image/png): passthrough de arquivo."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-ext-mtls",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/command",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "command"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-ext-mtls\",\n  \"type\": \"POST\",\n  \"route\": \"{{httpbin_url}}/post\",\n  \"contentType\": \"application/json\",\n  \"certificateName\": \"zt-cert-teste\",\n  \"body\": {\n    \"fields\": [\n      {\n        \"name\": \"mensagem\",\n        \"type\": \"string\",\n        \"required\": true\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "description": "POST com mTLS: o PFX `zt-cert-teste` (pasta 07) e carregado do BoltDB e usado no TLS do client."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ]
        },
        {
          "name": "02 - Routers",
          "item": [
            {
              "name": "zt-r-ext-cep",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-cep\",\n  \"path\": \"/api/ext/cep/{CEP}\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"GET\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-cep-get\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-posts",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-posts\",\n  \"path\": \"/api/ext/posts\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": false,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"GET\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-posts-listar\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-post-criar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-post-criar\",\n  \"path\": \"/api/ext/posts\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 201,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"POST\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-post-criar\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-post-atualizar",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-post-atualizar\",\n  \"path\": \"/api/ext/posts/{id}\",\n  \"method\": \"PUT\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"PUT\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-post-atualizar\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-post-remover",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-post-remover\",\n  \"path\": \"/api/ext/posts/{id}\",\n  \"method\": \"DELETE\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"REMOVE\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-post-remover\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-form",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-form\",\n  \"path\": \"/api/ext/httpbin/form\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"POST\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-form-urlencoded\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-multipart",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-multipart\",\n  \"path\": \"/api/ext/httpbin/multipart\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"POST\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-multipart\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-download",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-download\",\n  \"path\": \"/api/ext/download/png\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"GET\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-download-png\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "zt-r-ext-mtls",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/router",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "router"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"key\": \"zt-r-ext-mtls\",\n  \"path\": \"/api/ext/mtls\",\n  \"method\": \"POST\",\n  \"response\": {\n    \"status\": 200,\n    \"contentType\": \"application/json\"\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"single-result\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"POST\",\n          \"return-result\": true,\n          \"name\": \"zt-ext-mtls\"\n        }\n      }\n    ]\n  }\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "});"
                    ]
                  }
                }
              ]
            }
          ]
        },
        {
          "name": "03 - Testes",
          "item": [
            {
              "name": "GET CEP (path param)",
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/cep/01001000",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "cep",
                    "01001000"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"ViaCEP\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().localidade).to.equal(\"São Paulo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "GET posts (query userId)",
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/posts?userId=1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "posts"
                  ],
                  "query": [
                    {
                      "key": "userId",
                      "value": "1"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"posts do usuario 1\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().length).to.equal(10);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "POST criar post (JSON)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/posts",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "posts"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"title\": \"Z-Agent\",\n  \"body\": \"gateway universal\",\n  \"userId\": 1\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"201 e eco\", function () {",
                      "  expect(res.getStatus()).to.equal(201);",
                      "  expect(res.getBody().title).to.equal(\"Z-Agent\");",
                      "  expect(res.getBody().id).to.exist;",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "POST criar post - body invalido (erro)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/posts",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "posts"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"title\": \"ab\",\n  \"userId\": 1\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Faltou `body` e `title` tem menos de 3 caracteres."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"400 validacao do body\", function () {",
                      "  expect(res.getStatus()).to.equal(400);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "PUT atualizar post",
              "request": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/posts/1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "posts",
                    "1"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"title\": \"novo titulo\",\n  \"body\": \"novo corpo\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().title).to.equal(\"novo titulo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "DELETE remover post (REMOVE)",
              "request": {
                "method": "DELETE",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/posts/1",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "posts",
                    "1"
                  ]
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"200\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "POST form-urlencoded",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  },
                  {
                    "key": "Content-Type",
                    "value": "application/json",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/httpbin/form",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "httpbin",
                    "form"
                  ]
                },
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"usuario\": \"jesse\",\n  \"perfil\": \"admin\"\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "auth": {
                  "type": "noauth"
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"httpbin recebeu como form\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().form.usuario).to.equal(\"jesse\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "POST multipart (upload)",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/httpbin/multipart",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "httpbin",
                    "multipart"
                  ]
                },
                "body": {
                  "mode": "formdata",
                  "formdata": [
                    {
                      "key": "descricao",
                      "value": "arquivo de teste",
                      "type": "text"
                    },
                    {
                      "key": "arquivo",
                      "type": "file",
                      "src": "certs/teste.pfx"
                    }
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "O arquivo enviado e o PFX de teste da pasta `certs/` (so para ter bytes)."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"httpbin recebeu o arquivo\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getBody().form.descricao).to.equal(\"arquivo de teste\");",
                      "  expect(res.getBody().files).to.have.property(\"arquivo\");",
                      "});"
                    ]
                  }
                }
              ]
            },
            {
              "name": "GET download binario (PNG)",
              "request": {
                "method": "GET",
                "header": [
                  {
                    "key": "Accept-Encoding",
                    "value": "identity",
                    "type": "text"
                  }
                ],
                "url": {
                  "raw": "{{z_agent_url}}/api/ext/download/png",
                  "host": [
                    "{{z_agent_url}}"
                  ],
                  "path": [
                    "api",
                    "ext",
                    "download",
                    "png"
                  ]
                },
                "auth": {
                  "type": "noauth"
                },
                "description": "Passthrough binario: Content-Type e bytes preservados."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                      "const expect = pm.expect;",
                      "const test = (name, fn) => pm.test(name, fn);",
                      "const res = {",
                      "  getStatus: () => pm.response.code,",
                      "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                      "  getHeader: (n) => pm.response.headers.get(n),",
                      "};",
                      "const bru = {",
                      "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                      "  getVar: (k) => pm.collectionVariables.get(k),",
                      "  interpolate: (s) => pm.variables.replaceIn(s),",
                      "};",
                      "// ---------------------------------------------------------------------------------",
                      "",
                      "test(\"devolve image/png\", function () {",
                      "  expect(res.getStatus()).to.equal(200);",
                      "  expect(res.getHeader(\"content-type\")).to.include(\"image/png\");",
                      "});"
                    ]
                  }
                }
              ]
            }
          ]
        }
      ],
      "description": "Executores HTTP: GET, POST, PUT, REMOVE (DELETE). Usam APIs publicas (ViaCEP, JSONPlaceholder, httpbin).\n- `{param}` na URL e substituido automaticamente pelo valor do parametro de mesmo nome. Declare o campo em `query.fields` com `paramType: QUERY` (se nao estiver na URL, vira `?nome=valor`). **Nao use `PATH` junto com `{param}`**: `PATH` e o modo legado que ANEXA o valor como mais um segmento (`/ws/01001000/json//01001000`).\n- O Z-Agent repassa TODOS os headers do cliente a API externa. Um `Accept-Encoding: gzip` (enviado por Bruno/axios/navegadores) faz a API responder comprimido e o Z-Agent nao decodifica o JSON (`invalid character x1f`). Nas chamadas de teste usamos `Accept-Encoding: identity`.\n- POST/PUT: o body JSON do cliente e validado contra `body.fields` (`required`, `type`, `minimum`/`maximum`) e enviado no `contentType` do command.\n- Todos os headers do cliente sao repassados a API externa.\n- Respostas nao JSON (PDF, imagem...) sao devolvidas como download."
    },
    {
      "name": "07 - Certificados (mTLS)",
      "item": [
        {
          "name": "Cadastrar certificado",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/certificate",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "certificate"
              ]
            },
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "name",
                  "value": "zt-cert-teste",
                  "type": "text"
                },
                {
                  "key": "password",
                  "value": "teste123",
                  "type": "text"
                },
                {
                  "key": "description",
                  "value": "Certificado autoassinado de teste",
                  "type": "text"
                },
                {
                  "key": "active",
                  "value": "true",
                  "type": "text"
                },
                {
                  "key": "pfxFile",
                  "type": "file",
                  "src": "certs/teste.pfx"
                }
              ]
            },
            "description": "`multipart/form-data`: name e pfxFile obrigatorios; password, description, active, expirationDate, caCertFile opcionais."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "const b = res.getBody(); if (b && b.id) bru.setVar(\"cert_id\", String(b.id));",
                  "test(\"201\", function () {",
                  "  expect(res.getStatus()).to.equal(201);",
                  "  expect(res.getBody().name).to.equal(\"zt-cert-teste\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar certificados",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/certificate",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "certificate"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"inclui o cadastrado\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().map(c => c.name)).to.include(\"zt-cert-teste\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar certificado por nome",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/certificate/name/zt-cert-teste",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "certificate",
                "name",
                "zt-cert-teste"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().name).to.equal(\"zt-cert-teste\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar certificado por ID",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/certificate/{{cert_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "certificate",
                "{{cert_id}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Atualizar certificado por nome",
          "request": {
            "method": "PUT",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/certificate/name/zt-cert-teste",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "certificate",
                "name",
                "zt-cert-teste"
              ]
            },
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "description",
                  "value": "Descricao atualizada",
                  "type": "text"
                },
                {
                  "key": "active",
                  "value": "true",
                  "type": "text"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Chamada mTLS via rota",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept-Encoding",
                "value": "identity",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/api/ext/mtls",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "ext",
                "mtls"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"mensagem\": \"ola mtls\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Se o PFX nao estiver em DER ocorre `asn1: indefinite length found`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"POST com client cert carregado do BoltDB\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().json.mensagem).to.equal(\"ola mtls\");",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Certificados PKCS#12 (PFX) em formato DER, guardados em Base64 no BoltDB. Referenciados pelo campo `certificateName` do command POST. O PFX de teste (senha `teste123`) esta em `certs/teste.pfx`."
    },
    {
      "name": "08 - Gerenciamento (Command e Router)",
      "item": [
        {
          "name": "Listar commands",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/command",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 com os commands zt-\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().filter(c => c.key.startsWith(\"zt-\")).length).to.be.at.least(30);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar command por key (query)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/command?key=zt-produtos-listar",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ],
              "query": [
                {
                  "key": "key",
                  "value": "zt-produtos-listar"
                }
              ]
            },
            "description": "Filtros: `?id=` ou `?key=`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "const b = res.getBody(); const c = Array.isArray(b) ? b[0] : b; if (c && c.id) bru.setVar(\"cmd_id\", String(c.id));",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar command por ID",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/command/{{cmd_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command",
                "{{cmd_id}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"hasFilter detectado e parametros\", function () {",
                  "  expect(res.getBody().key).to.equal(\"zt-produtos-listar\");",
                  "  expect(res.getBody().parameters).to.be.an(\"array\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Command duplicado (erro)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/command",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-produtos-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT 1 FROM DUAL\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 ja existe\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  expect(res.getBody().message).to.include(\"already exists\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "UPDATE sem WHERE (erro do validador)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/command",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-invalido-update\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"UPDATE\",\n  \"sql\": \"UPDATE PRODUTO SET ATIVO = 'N'\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "UPDATE/DELETE precisam de WHERE com valores reais."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 SQLValidator\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "DELETE sem WHERE (erro do validador)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/command",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-invalido-delete\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"DELETE\",\n  \"sql\": \"DELETE FROM PRODUTO\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 SQLValidator\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Atualizar command por ID",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/command/{{cmd_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command",
                "{{cmd_id}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-produtos-listar\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT ID, CODIGO, DESCRICAO, CATEGORIA, UNIDADE, CONTROLA_LOTE, PRECO_CUSTO, ATIVO FROM PRODUTO WHERE (:CODIGO IS NULL OR CODIGO = :CODIGO) AND (:CATEGORIA IS NULL OR CATEGORIA = :CATEGORIA) AND (:ATIVO IS NULL OR ATIVO = :ATIVO) AND (:DESCRICAO IS NULL OR DESCRICAO LIKE :DESCRICAO)\",\n  \"parameters\": [\n    {\n      \"name\": \"CODIGO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"CATEGORIA\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"ATIVO\",\n      \"type\": \"string\"\n    },\n    {\n      \"name\": \"DESCRICAO\",\n      \"type\": \"string\"\n    }\n  ],\n  \"order\": {\n    \"columnName\": \"DESCRICAO\",\n    \"desc\": false\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "description": "A `key` nao pode ser alterada."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Atualizar command - trocar key (erro)",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/command/{{cmd_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command",
                "{{cmd_id}}"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"outra-key\",\n  \"databaseType\": \"oracle\",\n  \"type\": \"QUERY\",\n  \"sql\": \"SELECT 1 FROM DUAL\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 key imutavel\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  expect(res.getBody().message).to.include(\"Cannot modify\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar routers",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 com rotas zt-\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().filter(r => r.key.startsWith(\"zt-\")).length).to.be.at.least(30);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar routers - filtro method",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/router?method=POST",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ],
              "query": [
                {
                  "key": "method",
                  "value": "POST"
                }
              ]
            },
            "description": "Filtros exclusivos: id, key, method, path."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"so POST\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().every(r => r.method === \"POST\")).to.equal(true);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar routers - filtro path",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/router?path=/api/suprimentos/produtos",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ],
              "query": [
                {
                  "key": "path",
                  "value": "/api/suprimentos/produtos"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"rotas do path\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().length).to.be.at.least(2);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar router por key",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/router?key=zt-r-produtos-listar",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ],
              "query": [
                {
                  "key": "key",
                  "value": "zt-r-produtos-listar"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "const b = res.getBody(); const r = Array.isArray(b) ? b[0] : b; if (r && r.id) bru.setVar(\"router_id\", String(r.id));",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Buscar router por ID",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/router/{{router_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router",
                "{{router_id}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 com steps\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().service.steps).to.be.an(\"array\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Router duplicado (erro)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-produtos-listar\",\n  \"path\": \"/x\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"QUERY\",\n          \"return-result\": true,\n          \"name\": \"zt-produtos-listar\",\n          \"database\": \"ORACLE_TESTES\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 ja existe\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Router com tipo de executor invalido (erro)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/router",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"key\": \"zt-r-tipo-invalido\",\n  \"path\": \"/x\",\n  \"method\": \"GET\",\n  \"response\": {\n    \"status\": 200\n  },\n  \"service\": {\n    \"single-thread\": true,\n    \"steps\": [\n      {\n        \"command\": {\n          \"type\": \"FOGUETE\",\n          \"name\": \"x\"\n        }\n      }\n    ]\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 service not found\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "CRUD dos proprios recursos do Z-Agent: listar, filtrar, buscar, atualizar, duplicidade e remocao."
    },
    {
      "name": "09 - Erros e Timeout",
      "item": [
        {
          "name": "Rota com timeout de 1ms (504)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/lento",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "lento"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"504 Gateway Timeout\", function () {",
                  "  expect(res.getStatus()).to.equal(504);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Header sobrescreve o timeout da rota",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-Request-Timeout-Ms",
                "value": "30000",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/lento",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "lento"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "O header tem a maior prioridade."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 (30s no header vence 1ms da rota)\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Header de timeout invalido (400)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-Request-Timeout-Ms",
                "value": "abc",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/produtos",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "produtos"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  expect(res.getBody().message).to.include(\"X-Request-Timeout-Ms\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Header de timeout zero (400)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-Request-Timeout-Ms",
                "value": "0",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/produtos",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "produtos"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Rota inexistente (404)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/nao-existe",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "nao-existe"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"404 do chi\", function () {",
                  "  expect(res.getStatus()).to.equal(404);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Metodo nao permitido (405)",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/saldo",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "saldo"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"405\", function () {",
                  "  expect(res.getStatus()).to.equal(405);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "SQL invalido na rota - estrutura do erro",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/lotes",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "lotes"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Formato de erro: `{timestamp, status, error, message, path, trace}`."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"HTTPErrorDTO completo\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  const b = res.getBody();",
                  "  expect(b).to.have.all.keys(\"timestamp\", \"status\", \"error\", \"message\", \"path\", \"trace\");",
                  "  expect(b.error).to.equal(\"Bad Request\");",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Timeout efetivo: header `X-Request-Timeout-Ms` > `x-request-timeout-ms` da rota > `DEFAULT_REQUEST_TIMEOUT_MS` > `DEFAULT_TIMEOUT` (60s). Estourou: 504. Header invalido: 400."
    },
    {
      "name": "10 - Limpeza",
      "item": [
        {
          "name": "Deletar paciente com movimentos (erro de FK)",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/pacientes/prontuario/{{zt_prontuario}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "pacientes",
                "prontuario",
                "{{zt_prontuario}}"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "O paciente de teste tem movimentos: o DELETE simples e barrado pela FK FK_MOV_PACIENTE."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 ORA-02292 (integridade referencial)\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  expect(res.getBody().message).to.include(\"ORA-02292\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Excluir paciente de teste (estorna o consumo)",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/pacientes/{{zt_paciente_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "pacientes",
                "{{zt_paciente_id}}"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "PROCEDURE PRC_EXCLUI_PACIENTE: devolve o saldo, apaga os movimentos e o paciente, tudo na mesma transacao."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"estorno de 1 movimento / 3 unidades\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().pacienteRemovido).to.equal(1);",
                  "  expect(res.getBody().movimentosEstornados).to.equal(1);",
                  "  expect(res.getBody().unidadesDevolvidas).to.equal(3);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Conferir saldo apos estorno",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/lotes?ID_PRODUTO=1",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "lotes"
              ],
              "query": [
                {
                  "key": "ID_PRODUTO",
                  "value": "1"
                }
              ]
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"saldo = antes + 5 (a entrada de 5 permanece, a saida de 3 foi estornada)\", function () {",
                  "  const l = res.getBody().find(x => String(x.ID_LOTE) === bru.getVar(\"zt_lote_id\"));",
                  "  expect(Number(l.SALDO)).to.equal(Number(bru.getVar(\"zt_saldo_antes\")) + 5);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Excluir paciente da carga inicial (erro)",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/pacientes/1",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "pacientes",
                "1"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "A procedure so exclui pacientes de teste (prontuario TST*)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400 ORA-20010 (protegido)\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "  expect(res.getBody().message).to.include(\"ORA-20010\");",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Remover certificado de teste",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/certificate/{{cert_id}}",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "certificate",
                "{{cert_id}}"
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"204\", function () {",
                  "  expect(res.getStatus()).to.equal(204);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Remover router por key",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/router?key=zt-r-produtos-listar",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "router"
              ],
              "query": [
                {
                  "key": "key",
                  "value": "zt-r-produtos-listar"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200 deletedCount 1\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().deletedCount).to.equal(1);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Rota removida deixa de responder",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/api/suprimentos/produtos",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "api",
                "suprimentos",
                "produtos"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Depois do `DELETE /router?key=` a rota some do roteador em runtime."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"404 (desregistrada do chi)\", function () {",
                  "  expect([404, 405]).to.include(res.getStatus());",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Remover command por key",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/command?key=zt-produtos-listar",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ],
              "query": [
                {
                  "key": "key",
                  "value": "zt-produtos-listar"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"200\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "  expect(res.getBody().deletedCount).to.equal(1);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Remover command inexistente (erro)",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/command?key=zt-nao-existe",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "command"
              ],
              "query": [
                {
                  "key": "key",
                  "value": "zt-nao-existe"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"400\", function () {",
                  "  expect(res.getStatus()).to.equal(400);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Reset final (remove tudo zt-*)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{z_agent_url}}/status",
              "host": [
                "{{z_agent_url}}"
              ],
              "path": [
                "status"
              ]
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Mesmo script da pasta 00. Remove routers, commands, certificados e a database ORACLE_TESTES."
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// Remove tudo que a colecao cria (prefixo zt-) e a database ORACLE_TESTES.",
                  "const base = pm.variables.replaceIn(\"{{z_agent_url}}\");",
                  "const token = pm.variables.replaceIn(\"{{zagent_token}}\");",
                  "const send = (method, path) => new Promise((resolve) => {",
                  "  pm.sendRequest({ url: base + path, method, header: { Authorization: \"Bearer \" + token } },",
                  "    (err, r) => resolve(err ? { code: 0, json: () => null } : r));",
                  "});",
                  "const list = async (p) => {",
                  "  const r = await send(\"GET\", p);",
                  "  if (r.code !== 200) return [];",
                  "  try { const j = r.json(); return Array.isArray(j) ? j : []; } catch (e) { return []; }",
                  "};",
                  "(async () => {",
                  "  const removed = { routers: 0, commands: 0, certificates: 0, databases: 0 };",
                  "  for (const r of await list(\"/router\")) if (String(r.key).startsWith(\"zt-\")) { await send(\"DELETE\", \"/router?key=\" + encodeURIComponent(r.key)); removed.routers++; }",
                  "  for (const c of await list(\"/command\")) if (String(c.key).startsWith(\"zt-\")) { await send(\"DELETE\", \"/command?key=\" + encodeURIComponent(c.key)); removed.commands++; }",
                  "  for (const c of await list(\"/certificate\")) if (String(c.name).startsWith(\"zt-\")) { await send(\"DELETE\", \"/certificate/\" + c.id); removed.certificates++; }",
                  "  const d = await send(\"DELETE\", \"/database?key=ORACLE_TESTES\");",
                  "  if (d.code === 204) removed.databases++;",
                  "  pm.collectionVariables.set(\"reset_removed\", JSON.stringify(removed));",
                  "})();",
                  ""
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// --- compatibilidade com a colecao Bruno (mesmos nomes res / bru / test / expect) ---",
                  "const expect = pm.expect;",
                  "const test = (name, fn) => pm.test(name, fn);",
                  "const res = {",
                  "  getStatus: () => pm.response.code,",
                  "  getBody: () => { try { return pm.response.json(); } catch (e) { return pm.response.text(); } },",
                  "  getHeader: (n) => pm.response.headers.get(n),",
                  "};",
                  "const bru = {",
                  "  setVar: (k, v) => pm.collectionVariables.set(k, v),",
                  "  getVar: (k) => pm.collectionVariables.get(k),",
                  "  interpolate: (s) => pm.variables.replaceIn(s),",
                  "};",
                  "// ---------------------------------------------------------------------------------",
                  "",
                  "test(\"ok\", function () {",
                  "  expect(res.getStatus()).to.equal(200);",
                  "});"
                ]
              }
            }
          ]
        }
      ],
      "description": "Remove os dados criados nos fluxos e todos os recursos `zt-*` do Z-Agent. Rotas: `DELETE /router?key=` desregistra tambem do roteador em memoria; `DELETE /router/{id}` so apaga do BoltDB."
    }
  ]
}