{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.wtf-p.dev/project/outline/v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "project_id", "revision", "thesis", "target_words", "sections", "updated_at"],
  "properties": {
    "schema": { "const": "wtfp.project.outline/v1" },
    "project_id": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/identifier" },
    "revision": { "type": "integer", "minimum": 0 },
    "thesis": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/nonEmptyString" },
    "target_words": { "type": "integer", "minimum": 1 },
    "sections": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "title",
          "goal",
          "argument_role",
          "word_target",
          "wave",
          "depends_on",
          "claim_ids",
          "research"
        ],
        "properties": {
          "id": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/identifier" },
          "title": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/nonEmptyString" },
          "goal": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/nonEmptyString" },
          "argument_role": {
            "enum": ["setup", "background", "method", "evidence", "synthesis", "implications", "conclusion", "other"]
          },
          "word_target": { "type": "integer", "minimum": 1 },
          "wave": { "type": "integer", "minimum": 1 },
          "depends_on": {
            "type": "array",
            "items": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/identifier" },
            "uniqueItems": true
          },
          "claim_ids": {
            "type": "array",
            "items": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/identifier" },
            "uniqueItems": true
          },
          "research": {
            "type": "object",
            "additionalProperties": false,
            "required": ["required", "topics"],
            "properties": {
              "required": { "type": "boolean" },
              "topics": {
                "type": "array",
                "items": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/nonEmptyString" },
                "uniqueItems": true
              }
            }
          }
        }
      }
    },
    "updated_at": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/timestamp" }
  }
}
