{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "StageTrace CLI help response 1.0",
  "type": "object",
  "required": [
    "schemaVersion",
    "command",
    "status",
    "data",
    "errors",
    "warnings",
    "timingMs"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.0"
    },
    "command": {
      "const": "help"
    },
    "status": {
      "type": "string",
      "enum": [
        "ok",
        "error"
      ]
    },
    "data": {
      "oneOf": [
        {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "command",
                "summary",
                "usage",
                "commands"
              ],
              "properties": {
                "command": {
                  "const": "help"
                },
                "summary": {
                  "type": "string"
                },
                "usage": {
                  "type": "string"
                },
                "commands": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "name",
                      "summary",
                      "usage",
                      "flags",
                      "exitCodes"
                    ],
                    "properties": {
                      "name": {
                        "type": "string",
                        "enum": [
                          "compose",
                          "edit",
                          "explain",
                          "export",
                          "help",
                          "inspect",
                          "layers",
                          "plugins",
                          "project",
                          "schema",
                          "tree",
                          "validate",
                          "version",
                          "visibility",
                          "watch",
                          "why"
                        ]
                      },
                      "summary": {
                        "type": "string"
                      },
                      "usage": {
                        "type": "string"
                      },
                      "flags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "exitCodes": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "name",
                "summary",
                "usage",
                "flags",
                "exitCodes"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "enum": [
                    "compose",
                    "edit",
                    "explain",
                    "export",
                    "help",
                    "inspect",
                    "layers",
                    "plugins",
                    "project",
                    "schema",
                    "tree",
                    "validate",
                    "version",
                    "visibility",
                    "watch",
                    "why"
                  ]
                },
                "summary": {
                  "type": "string"
                },
                "usage": {
                  "type": "string"
                },
                "flags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "exitCodes": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                }
              },
              "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": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "command",
                  "summary",
                  "usage",
                  "commands"
                ],
                "properties": {
                  "command": {
                    "const": "help"
                  },
                  "summary": {
                    "type": "string"
                  },
                  "usage": {
                    "type": "string"
                  },
                  "commands": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "name",
                        "summary",
                        "usage",
                        "flags",
                        "exitCodes"
                      ],
                      "properties": {
                        "name": {
                          "type": "string",
                          "enum": [
                            "compose",
                            "edit",
                            "explain",
                            "export",
                            "help",
                            "inspect",
                            "layers",
                            "plugins",
                            "project",
                            "schema",
                            "tree",
                            "validate",
                            "version",
                            "visibility",
                            "watch",
                            "why"
                          ]
                        },
                        "summary": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "string"
                        },
                        "flags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "exitCodes": {
                          "type": "array",
                          "items": {
                            "type": "number"
                          }
                        }
                      },
                      "additionalProperties": false
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "name",
                  "summary",
                  "usage",
                  "flags",
                  "exitCodes"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "enum": [
                      "compose",
                      "edit",
                      "explain",
                      "export",
                      "help",
                      "inspect",
                      "layers",
                      "plugins",
                      "project",
                      "schema",
                      "tree",
                      "validate",
                      "version",
                      "visibility",
                      "watch",
                      "why"
                    ]
                  },
                  "summary": {
                    "type": "string"
                  },
                  "usage": {
                    "type": "string"
                  },
                  "flags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "exitCodes": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  }
                },
                "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
}
