{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/autonomous-solutions/json-schema/autonomous-solutions-hub-event-schema.json",
  "title": "HubEvent",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/autonomous-solutions-vensmart-api-openapi.yml#/components/schemas/HubEvent",
  "properties": {
    "message_type": {
      "$ref": "#/$defs/HubMessageType"
    },
    "message_content": {
      "$ref": "#/$defs/MessageContent"
    }
  },
  "type": "object",
  "required": [
    "message_type",
    "message_content"
  ],
  "$defs": {
    "BinStatus": {
      "properties": {
        "bin_num": {
          "type": "integer",
          "title": "Bin Num"
        },
        "occurrence": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Occurrence"
        },
        "status_code": {
          "type": "integer",
          "title": "Status Code"
        },
        "is_ready": {
          "type": "boolean",
          "title": "Is Ready",
          "default": false
        },
        "is_dropped": {
          "type": "boolean",
          "title": "Is Dropped",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "bin_num",
        "status_code"
      ],
      "title": "BinStatus",
      "description": "Status information for an individual bin.\n\nAttributes:\n    bin_num: The bin number\n    occurrence: The occurrence count for this bin (for handling multiple bins with the same number)\n    status_code: VensmartStatusCode indicating the bin's current state\n    is_ready: Whether the bin is ready to be opened\n    is_dropped: Whether all items in this bin were dropped"
    },
    "DroppedItem": {
      "properties": {
        "quantity": {
          "type": "integer",
          "title": "Quantity"
        },
        "product_detail_id": {
          "type": "integer",
          "title": "Product Detail Id"
        }
      },
      "type": "object",
      "required": [
        "quantity",
        "product_detail_id"
      ],
      "title": "DroppedItem"
    },
    "HubMessageType": {
      "type": "string",
      "enum": [
        "info",
        "warning",
        "error",
        "update",
        "heartbeat",
        "notification",
        "order_completed",
        "order_update",
        "order_started",
        "door_opened"
      ],
      "title": "HubMessageType"
    },
    "MessageContent": {
      "properties": {
        "user_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "User Id"
        },
        "order_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Order Id"
        },
        "status_code": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status Code"
        },
        "current_bin": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Current Bin"
        },
        "bin_num": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bin Num"
        },
        "bins_status": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/BinStatus"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bins Status"
        },
        "dropped_items": {
          "additionalProperties": {
            "$ref": "#/$defs/DroppedItem"
          },
          "type": "object",
          "title": "Dropped Items",
          "default": {}
        },
        "bin_nums": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Bin Nums",
          "default": []
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message"
        },
        "hub_response_status_code": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hub Response Status Code"
        }
      },
      "type": "object",
      "title": "MessageContent"
    }
  }
}