{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hwlab.pikastech.local/protocol/schemas/box-capability.schema.json",
  "title": "HWLAB Box Capability",
  "type": "object",
  "required": [
    "capabilityId",
    "resourceId",
    "projectId",
    "name",
    "direction",
    "valueType",
    "mutatesState",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "capabilityId": {
      "$ref": "common.json#/$defs/id"
    },
    "resourceId": {
      "$ref": "common.json#/$defs/id"
    },
    "projectId": {
      "$ref": "common.json#/$defs/id"
    },
    "name": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
    },
    "description": {
      "type": "string",
      "maxLength": 1000
    },
    "direction": {
      "type": "string",
      "enum": ["input", "output", "bidirectional"]
    },
    "valueType": {
      "type": "string",
      "enum": ["boolean", "integer", "number", "string", "object", "binary"]
    },
    "unit": {
      "type": "string",
      "maxLength": 32
    },
    "constraints": {
      "$ref": "common.json#/$defs/jsonObject"
    },
    "mutatesState": {
      "type": "boolean"
    },
    "createdAt": {
      "$ref": "common.json#/$defs/timestamp"
    },
    "updatedAt": {
      "$ref": "common.json#/$defs/timestamp"
    }
  },
  "additionalProperties": false
}
