meta {
  name: POST interact - prototype_resource_node_alpha (NEO-63 gather)
  type: http
  seq: 11
}

docs {
  NEO-63: successful interact on `resource_node` kind runs GatherOperations — inventory grant (scrap_metal_bulk), salvage XP (activity, 10), and depletion. Pre-request moves in range of alpha anchor (12, -6). Optional: GET inventory / skill-progression after this request.
}

script:pre-request {
  const axios = require("axios");
  const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
  const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
  await axios.post(
    `${baseUrl}/game/players/${playerId}/move`,
    {
      schemaVersion: 1,
      target: { x: 10, y: 0.9, z: -6 },
    },
    { headers: { "Content-Type": "application/json" } },
  );
}

post {
  url: {{baseUrl}}/game/players/{{playerId}}/interact
  body: json
  auth: none
}

headers {
  content-type: application/json
}

body:json {
  {
    "schemaVersion": 1,
    "interactableId": "prototype_resource_node_alpha"
  }
}

tests {
  test("interact allowed", function () {
    expect(res.getStatus()).to.equal(200);
    const body = res.getBody();
    expect(body.allowed).to.equal(true);
    expect(body.interactableId).to.equal("prototype_resource_node_alpha");
  });
}
