meta {
  name: POST inventory remove
  type: http
  seq: 4
}

docs {
  NEO-55: remove stack via mutationKind remove. Run Post inventory add first on a fresh server,
  or expect applied true when dev-local-1 already holds scrap_metal_bulk.
}

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

body:json {
  {
    "schemaVersion": 1,
    "mutationKind": "remove",
    "itemId": "scrap_metal_bulk",
    "quantity": 2
  }
}

tests {
  test("remove returns 200 with applied true and reduced quantity", function () {
    expect(res.getStatus()).to.equal(200);
    const body = res.getBody();
    expect(body.schemaVersion).to.equal(1);
    expect(body.applied).to.equal(true);
    expect(body.reasonCode).to.equal(null);
    expect(body.inventory).to.be.an("object");
    const scrap = body.inventory.bagSlots.find((s) => s.itemId === "scrap_metal_bulk");
    if (scrap) {
      expect(scrap.quantity).to.be.a("number");
      expect(scrap.quantity).to.be.at.least(0);
    }
  });
}
