meta {
  name: POST ability cast happy (NEO-30 cast accept path)
  type: http
  seq: 22
}

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: -5, y: 0.9, z: -5 },
    },
    { headers: { "Content-Type": "application/json" } },
  );
}

post {
  url: {{baseUrl}}/game/players/dev-local-1/ability-cast
  body: json
  auth: none
}

body:json {
  {
    "schemaVersion": 1,
    "slotIndex": 0,
    "abilityId": "prototype_pulse",
    "targetId": "prototype_target_alpha"
  }
}

tests {
  test("status 200", function () {
    // NEO-30 review follow-up: cast JSON contract unchanged (server comments only).
    // Optional: NEON_SPRAWL_API_LOG=1 on server prints ability_cast_requested for accepted JSON.
    expect(res.getStatus()).to.equal(200);
  });

  test("accepted true", function () {
    const body = res.getBody();
    expect(body.schemaVersion).to.equal(1);
    expect(body.accepted).to.equal(true);
  });
}
