{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "StageTrace CLI project response 1.0",
  "type": "object",
  "required": [
    "schemaVersion",
    "command",
    "status",
    "data",
    "errors",
    "warnings",
    "timingMs"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.0"
    },
    "command": {
      "const": "project"
    },
    "status": {
      "type": "string",
      "enum": [
        "ok",
        "error"
      ]
    },
    "data": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "mode",
            "project",
            "inspectIssueCount",
            "inspectTimeMs"
          ],
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "init",
                "open"
              ]
            },
            "project": {
              "type": "object",
              "required": [
                "schemaVersion",
                "projectPath",
                "rootStage",
                "rootStagePath",
                "sessionLayerPath",
                "attachedStages",
                "mutedLayers",
                "pluginSearchPaths",
                "editTarget",
                "selection",
                "timeCode",
                "recentCommands",
                "lastInspectSummary",
                "relativePathBase",
                "createdAt",
                "updatedAt"
              ],
              "properties": {
                "schemaVersion": {
                  "type": "string"
                },
                "projectPath": {
                  "type": "string"
                },
                "rootStage": {
                  "type": "string"
                },
                "rootStagePath": {
                  "type": "string"
                },
                "sessionLayerPath": {
                  "type": "string"
                },
                "attachedStages": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "mutedLayers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "pluginSearchPaths": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "editTarget": {
                  "type": "string"
                },
                "selection": {
                  "type": "string"
                },
                "timeCode": {
                  "type": "string"
                },
                "recentCommands": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "lastInspectSummary": {
                  "type": "object",
                  "required": [
                    "errors",
                    "warnings",
                    "info"
                  ],
                  "properties": {
                    "errors": {
                      "type": "number"
                    },
                    "warnings": {
                      "type": "number"
                    },
                    "info": {
                      "type": "number"
                    }
                  },
                  "additionalProperties": false
                },
                "relativePathBase": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            },
            "inspectIssueCount": {
              "type": "number"
            },
            "inspectTimeMs": {
              "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": {
            "type": "object",
            "required": [
              "mode",
              "project",
              "inspectIssueCount",
              "inspectTimeMs"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "init",
                  "open"
                ]
              },
              "project": {
                "type": "object",
                "required": [
                  "schemaVersion",
                  "projectPath",
                  "rootStage",
                  "rootStagePath",
                  "sessionLayerPath",
                  "attachedStages",
                  "mutedLayers",
                  "pluginSearchPaths",
                  "editTarget",
                  "selection",
                  "timeCode",
                  "recentCommands",
                  "lastInspectSummary",
                  "relativePathBase",
                  "createdAt",
                  "updatedAt"
                ],
                "properties": {
                  "schemaVersion": {
                    "type": "string"
                  },
                  "projectPath": {
                    "type": "string"
                  },
                  "rootStage": {
                    "type": "string"
                  },
                  "rootStagePath": {
                    "type": "string"
                  },
                  "sessionLayerPath": {
                    "type": "string"
                  },
                  "attachedStages": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "mutedLayers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "pluginSearchPaths": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "editTarget": {
                    "type": "string"
                  },
                  "selection": {
                    "type": "string"
                  },
                  "timeCode": {
                    "type": "string"
                  },
                  "recentCommands": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "lastInspectSummary": {
                    "type": "object",
                    "required": [
                      "errors",
                      "warnings",
                      "info"
                    ],
                    "properties": {
                      "errors": {
                        "type": "number"
                      },
                      "warnings": {
                        "type": "number"
                      },
                      "info": {
                        "type": "number"
                      }
                    },
                    "additionalProperties": false
                  },
                  "relativePathBase": {
                    "type": "string"
                  },
                  "createdAt": {
                    "type": "string"
                  },
                  "updatedAt": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              },
              "inspectIssueCount": {
                "type": "number"
              },
              "inspectTimeMs": {
                "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
}
