{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "version": "2.0.0",
  "$id": "https://schemas.ectropy.ai/resource/resource-status.schema.json",
  "title": "Resource Status Schema",
  "description": "Two-axis status for any tracked resource (human, robot, agent, equipment, material, inspection): availability (is it reachable and allocatable for new work) and activity (what it is doing now), the same two-axis pattern voxel-group uses for rolledUpStatus (work progress) and rolledUpHealth (risk). A single legacy status value maps as AVAILABLE -> (AVAILABLE, IDLE), ASSIGNED -> (ASSIGNED, IDLE), WORKING -> (ASSIGNED, WORKING), BREAK -> (AVAILABLE, BREAK), OFFLINE -> (OFFLINE, IDLE).",
  "type": "object",
  "required": [
    "$schema",
    "resourceUrn",
    "resourceType",
    "availability",
    "activity"
  ],
  "definitions": {
    "resourceType": {
      "type": "string",
      "description": "Resource taxonomy.",
      "enum": [
        "human",
        "robot",
        "agent",
        "equipment",
        "material",
        "inspection"
      ]
    },
    "availability": {
      "type": "string",
      "description": "Availability axis: is this resource currently reachable and allocatable for new work.",
      "enum": [
        "AVAILABLE",
        "ASSIGNED",
        "OFFLINE"
      ]
    },
    "activity": {
      "type": "string",
      "description": "Activity axis: what the resource is doing right now, independent of its availability. A resource on a scheduled break is AVAILABLE with activity BREAK.",
      "enum": [
        "IDLE",
        "WORKING",
        "BREAK"
      ]
    }
  },
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri",
      "description": "Schema declaration: the URI of the schema this instance follows."
    },
    "resourceUrn": {
      "$ref": "https://schemas.ectropy.ai/_definitions/urn.schema.json",
      "description": "The resource described, urn:luhtech:ectropy:resource:{id}."
    },
    "resourceType": {
      "$ref": "#/definitions/resourceType"
    },
    "availability": {
      "$ref": "#/definitions/availability"
    },
    "activity": {
      "$ref": "#/definitions/activity"
    },
    "utilization": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Utilization, 0 to 1."
    },
    "lastUpdate": {
      "type": "string",
      "format": "date-time",
      "description": "Observation time (ROS builtin_interfaces/Time)."
    }
  },
  "additionalProperties": false
}
