meta {
  name: POST craft deny inventory full
  type: http
  seq: 3
}

docs {
  NEO-70: make_prototype_armor when equipment slot is occupied denies with inventory_full. Pre-request seeds materials and fills equipment via inventory POST (deny setup only — not part of spine).
}

script:pre-request {
  const { ensureItemQuantity } = require("./scripts/inventory-api-helper.js");

  await ensureItemQuantity(bru, "refined_plate_stock", 8);
  await ensureItemQuantity(bru, "scrap_metal_bulk", 5);
  await ensureItemQuantity(bru, "prototype_armor_shell", 1);
}

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

headers {
  content-type: application/json
}

body:json {
  {
    "schemaVersion": 1,
    "recipeId": "make_prototype_armor"
  }
}

tests {
  test("denies with inventory_full when equipment slot occupied", function () {
    expect(res.getStatus()).to.equal(200);
    const body = res.getBody();
    expect(body.schemaVersion).to.equal(1);
    expect(body.success).to.equal(false);
    expect(body.reasonCode).to.equal("inventory_full");
    expect(body.inputsConsumed).to.be.an("array").that.is.empty;
    expect(body.outputsGranted).to.be.an("array").that.is.empty;
  });
}
