{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "StageTrace CLI tree response 1.0",
  "type": "object",
  "required": [
    "schemaVersion",
    "command",
    "status",
    "data",
    "errors",
    "warnings",
    "timingMs"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.0"
    },
    "command": {
      "const": "tree"
    },
    "status": {
      "type": "string",
      "enum": [
        "ok",
        "error"
      ]
    },
    "data": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "rootPrim",
            "depth",
            "page",
            "pageSize",
            "totalPrims",
            "totalPages",
            "nodes"
          ],
          "properties": {
            "rootPrim": {
              "type": "string"
            },
            "depth": {
              "type": "number"
            },
            "page": {
              "type": "number"
            },
            "pageSize": {
              "type": "number"
            },
            "totalPrims": {
              "type": "number"
            },
            "totalPages": {
              "type": "number"
            },
            "nodes": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "path",
                  "name",
                  "typeName",
                  "childCount",
                  "hasChildren",
                  "isActive",
                  "isLoaded",
                  "hasVariants",
                  "compositionArcs"
                ],
                "properties": {
                  "path": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "typeName": {
                    "type": "string"
                  },
                  "childCount": {
                    "type": "number"
                  },
                  "hasChildren": {
                    "type": "boolean"
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "isLoaded": {
                    "type": "boolean"
                  },
                  "hasVariants": {
                    "type": "boolean"
                  },
                  "compositionArcs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      ]
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["code", "message"],
        "properties": {
          "code": {"type": "string"},
          "message": {"type": "string"}
        },
        "additionalProperties": false
      }
    },
    "timingMs": {
      "type": "number"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "status": {
            "const": "ok"
          }
        },
        "required": [
          "status"
        ]
      },
      "then": {
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "rootPrim",
              "depth",
              "page",
              "pageSize",
              "totalPrims",
              "totalPages",
              "nodes"
            ],
            "properties": {
              "rootPrim": {
                "type": "string"
              },
              "depth": {
                "type": "number"
              },
              "page": {
                "type": "number"
              },
              "pageSize": {
                "type": "number"
              },
              "totalPrims": {
                "type": "number"
              },
              "totalPages": {
                "type": "number"
              },
              "nodes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "path",
                    "name",
                    "typeName",
                    "childCount",
                    "hasChildren",
                    "isActive",
                    "isLoaded",
                    "hasVariants",
                    "compositionArcs"
                  ],
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "typeName": {
                      "type": "string"
                    },
                    "childCount": {
                      "type": "number"
                    },
                    "hasChildren": {
                      "type": "boolean"
                    },
                    "isActive": {
                      "type": "boolean"
                    },
                    "isLoaded": {
                      "type": "boolean"
                    },
                    "hasVariants": {
                      "type": "boolean"
                    },
                    "compositionArcs": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "errors": {
            "type": "array",
            "maxItems": 0
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "status": {
            "const": "error"
          }
        },
        "required": [
          "status"
        ]
      },
      "then": {
        "properties": {
          "data": {
            "type": "object",
            "properties": {},
            "additionalProperties": false
          },
          "errors": {
            "type": "array",
            "minItems": 1
          }
        }
      }
    }
  ],
  "additionalProperties": false
}
