{
  "$schema": "https://apidocs.iqrf.org/iqrf-gateway-daemon/latest/com.iqrftech.self-desc/schema/jsonschema/1-0-0#",
  "self": {
    "vendor": "com.iqrftech.self-desc",
    "name": "messageError-response",
    "format": "jsonschema",
    "version": "1-0-0"
  },
  "title": "Message error response",
  "type": "object",
  "required": [
    "mType",
    "data"
  ],
  "additionalProperties": false,
  "properties": {
   "mType": {
      "$id": "#/properties/mType",
      "title": "Message type",
      "type": "string",
      "enum": ["messageError"]
    },
    "data": {
      "title": "Message data",
      "description": "Contains the message payload.",
      "type": "object",
      "required": [
        "msgId",
        "rsp",
        "status",
        "statusStr",
        "insId"
      ],
      "additionalProperties": false,
      "properties": {
        "msgId": {
          "$id": "#/properties/data/properties/msgId",
          "title": "Message ID",
          "description": "Message ID used for pairing requests and responses.",
          "type": "string"
        },
        "rsp": {
          "title": "Response",
          "description": "Holds response data",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "message": {
              "title": "Received message",
              "description": "Contents of received message.",
              "type": "string"
            },
            "error": {
              "title": "Error message",
              "description": "Cause of error or validation failure.",
              "type": "string"
            },
            "offset": {
              "title": "Parse error offset",
              "description": "Offset in received message where JSON parsing error begins.",
              "type": "integer"
            },
            "ignoredMessage": {
              "title": "Ignored message",
              "description": "Message type of received and discarded image.",
              "type": "string"
            },
            "capacity": {
              "title": "Queue capacity",
              "description": "Capacity of message queue that refused received message.",
              "type": "integer"
            }
          }
        },
        "insId": {
          "$id": "#/properties/data/properties/insId",
          "title": "Instance ID",
          "description": "Daemon insteance ID.",
          "type": "string"
        },
        "status": {
          "$id": "#/properties/data/properties/status",
          "title": "Status code",
          "description": "Status code.",
          "type": "integer"
        },
        "statusStr": {
          "$id": "#/properties/data/properties/statusStr",
          "title": "Status string",
          "description": "Verbose status string",
          "type": "string"
        }
      },
      "oneOf": [
        {
          "properties": {
            "status": {"enum": [1, 4]},
            "rsp": {
              "required": ["message", "error"],
              "not": {"required": ["offset", "ignoredMessage", "capacity"]}
            }
          }
        },
        {
          "properties": {
            "status": {"const": 2},
            "rsp": {
              "required": ["message", "error", "offset"],
              "not": {"required": ["ignoredMessage", "capacity"]}
            }
          }
        },
        {
          "properties": {
            "status": {"const": 3},
            "rsp": {
              "required": ["message"],
              "not": {"required": ["error", "offset", "ignoredMessage", "capacity"]}
            }
          }
        },
        {
          "properties": {
            "status": {"enum": [5, 7]},
            "rsp": {
              "required": ["ignoredMessage"],
              "not": {"required": ["message", "error", "offset", "capacity"]}
            }
          }
        },
        {
          "properties": {
            "status": {"enum": [6, 8]},
            "rsp": {
              "required": ["ignoredMessage", "capacity"],
              "not": {"required": ["message", "error", "offset"]}
            }
          }
        },
        {
          "properties": {
            "status": {"const": 9},
            "rsp": {
              "required": ["error"],
              "not": {"required": ["message", "offset", "ignoredMessage", "capacity"]}
            }
          }
        }
      ]
    }
  }
}
