# LocationsApi document shapes

This service expects JSON request bodies for location creation and updates and
stores location documents in MongoDB.

Inbound JSON documents
- CreateLocationRequest (`POST /api/locations`)
  ```json
  {
    "name": "string",
    "coord": {
      "x": 0,
      "y": 0
    }
  }
  ```
- UpdateLocationRequest (`PUT /api/locations/{id}`)
  ```json
  {
    "name": "string"
  }
  ```
  `coord` cannot be updated.
- GatherResourceRequest (`POST /api/locations/{id}/gather`)
  ```json
  {
    "characterId": "string (Character ObjectId)",
    "resourceKey": "wood"
  }
  ```

Stored documents (MongoDB)
- Location
  ```json
  {
    "id": "string (ObjectId)",
    "name": "string",
    "coord": {
      "x": 0,
      "y": 0
    },
    "biomeKey": "plains",
    "resources": [
      {
        "itemKey": "wood",
        "remainingQuantity": 100,
        "gatherQuantity": 3
      }
    ],
    "createdUtc": "string (ISO-8601 datetime)"
  }
  ```

Outbound JSON documents
- GatherResourceResponse (`POST /api/locations/{id}/gather`)
  ```json
  {
    "locationId": "string (ObjectId)",
    "characterId": "string (ObjectId)",
    "resourceKey": "wood",
    "quantityGranted": 3,
    "remainingQuantity": 97,
    "inventoryResponseJson": "string (raw InventoryApi response JSON)"
  }
  ```
