{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commentary-dev/json-schema/commentary-dev-draft-review-schema.json",
  "title": "DraftReview",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commentary-dev-draft-reviews-api-openapi.yml#/components/schemas/DraftReview",
  "type": "object",
  "properties": {
    "collaboration": {
      "$ref": "#/$defs/ReviewCollaborationState"
    },
    "id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "sourceType": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "archived"
      ]
    },
    "visibility": {
      "type": "string"
    },
    "gitBase": {
      "$ref": "#/$defs/DraftGitBase"
    },
    "reviewUrl": {
      "type": "string",
      "format": "uri"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "planOfRecordRevision": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "revisionNumber": {
              "type": "number"
            },
            "summary": {
              "type": [
                "string",
                "null"
              ]
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "additionalProperties": true
        },
        {
          "type": "null"
        }
      ]
    },
    "files": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DraftReviewFile"
      }
    },
    "latestRevision": {
      "oneOf": [
        {
          "$ref": "#/$defs/DraftRevision"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": true,
  "$defs": {
    "DraftGitBase": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "provider": {
          "type": "string",
          "enum": [
            "github"
          ]
        },
        "owner": {
          "type": "string"
        },
        "repo": {
          "type": "string"
        },
        "ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "sha": {
          "type": [
            "string",
            "null"
          ]
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "DraftReviewFile": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "contentType": {
          "type": "string",
          "enum": [
            "markdown",
            "html",
            "plain_text",
            "image",
            "svg",
            "mermaid"
          ]
        },
        "currentRevisionId": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": true
    },
    "DraftRevision": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "revisionNumber": {
          "type": "integer"
        },
        "label": {
          "type": "string"
        },
        "origin": {
          "type": "string"
        },
        "summary": {
          "type": [
            "string",
            "null"
          ]
        },
        "agentAlias": {
          "type": [
            "string",
            "null"
          ],
          "description": "Stable per-agent identifier for agent-authored activity. clientName is not a substitute; the connected human identity remains visible."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "ReviewCollaborationState": {
      "type": "object",
      "required": [
        "review",
        "settings",
        "permissions",
        "providerSync",
        "revisionKey"
      ],
      "properties": {
        "review": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "draft"
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                }
              },
              "required": [
                "kind",
                "id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "package"
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                }
              },
              "required": [
                "kind",
                "id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "guide"
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                }
              },
              "required": [
                "kind",
                "id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "snapshot"
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                }
              },
              "required": [
                "kind",
                "id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "preview"
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                }
              },
              "required": [
                "kind",
                "id"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "pr"
                },
                "provider": {
                  "enum": [
                    "github",
                    "azure_devops"
                  ]
                },
                "owner": {
                  "type": "string"
                },
                "repo": {
                  "type": "string"
                },
                "projectName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "prNumber": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "required": [
                "kind",
                "provider",
                "owner",
                "repo",
                "prNumber"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "branch"
                },
                "provider": {
                  "enum": [
                    "github",
                    "azure_devops"
                  ]
                },
                "owner": {
                  "type": "string"
                },
                "repo": {
                  "type": "string"
                },
                "projectName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "branchRef": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "provider",
                "owner",
                "repo",
                "branchRef"
              ],
              "additionalProperties": false
            }
          ]
        },
        "settings": {
          "type": "object",
          "required": [
            "version",
            "polls",
            "consensus"
          ],
          "properties": {
            "version": {
              "type": "integer",
              "minimum": 0
            },
            "polls": {
              "type": "boolean"
            },
            "consensus": {
              "type": "object"
            }
          },
          "additionalProperties": false
        },
        "permissions": {
          "type": "object",
          "properties": {
            "comment": {
              "type": "boolean"
            },
            "configure": {
              "type": "boolean"
            },
            "humanSignOff": {
              "type": "boolean"
            }
          }
        },
        "providerSync": {
          "type": "object",
          "properties": {
            "comments": {
              "type": "boolean"
            },
            "pollSnapshots": {
              "type": "boolean"
            },
            "liveVotes": {
              "const": false
            },
            "decisions": {
              "const": false
            }
          }
        },
        "revisionKey": {
          "type": [
            "string",
            "null"
          ]
        },
        "filePaths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "participants": {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      },
      "additionalProperties": false
    }
  }
}