{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://theamateur.co.uk/schemas/dpl/dpl.missing-1.schema.json",
  "title": "DPL missing details (dpl.missing/1)",
  "description": "What `dpl missing <plan> --format json` writes: the questions an agent should put to its human so that the readiness checks can run on a plan, in the plan's own names, with the plan paths each answer fills and the rules it unlocks. Every member listed here is always written, or left out when null; nothing else appears.",
  "$comment": "`plan_hash` and `rules_version` are the ones `dpl readiness` reports for the same plan, so the questions name the rules of that version. A question's `id` is a hash of its kind and the plan ids it is about, so it survives edits elsewhere in the plan. `dpl missing` exits 4 when some question blocks the assessment of a scene, 0 otherwise.",
  "type": "object",
  "properties": {
    "schema": {
      "type": "string",
      "const": "dpl.missing/1"
    },
    "work_id": {
      "type": "string"
    },
    "plan_hash": {
      "description": "The same revision hash readiness reports for this plan.",
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "rules_version": {
      "description": "The same rules version readiness reports: the unlocks name rules of this version.",
      "type": "string"
    },
    "summary": {
      "$ref": "#/$defs/MissingSummary"
    },
    "questions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MissingQuestion"
      }
    }
  },
  "required": [
    "schema",
    "work_id",
    "plan_hash",
    "rules_version",
    "summary",
    "questions"
  ],
  "additionalProperties": false,
  "$defs": {
    "MissingQuestion": {
      "type": "object",
      "description": "One thing to ask the human.",
      "properties": {
        "id": {
          "description": "Stable: a hash of the kind and the plan ids it is about, so it survives edits elsewhere in the plan.",
          "type": "string",
          "pattern": "^q-[0-9a-f]{12}$"
        },
        "scene": {
          "type": [
            "string",
            "null"
          ]
        },
        "shots": {
          "description": "The shots the question is about, when it is about particular shots.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "kind": {
          "$ref": "#/$defs/QuestionKind"
        },
        "priority": {
          "$ref": "#/$defs/QuestionPriority"
        },
        "question": {
          "description": "Plain English, in the plan's own names.",
          "type": "string"
        },
        "why": {
          "description": "Why it is being asked, in one sentence.",
          "type": "string"
        },
        "fills": {
          "description": "The plan paths the answer would populate ([*] is every element).",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "unlocks": {
          "description": "The readiness rules that start to bite on this scene once the answer is in the plan.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "answer_shape": {
          "description": "The shape of the answer: the DPL fragment, or the allowed terms.",
          "type": "string"
        }
      },
      "required": [
        "id",
        "kind",
        "priority",
        "question",
        "why",
        "fills",
        "unlocks",
        "answer_shape"
      ],
      "additionalProperties": false
    },
    "MissingSummary": {
      "type": "object",
      "properties": {
        "questions": {
          "type": "integer",
          "minimum": 0
        },
        "blocking_assessment": {
          "type": "integer",
          "minimum": 0
        },
        "improves_assessment": {
          "type": "integer",
          "minimum": 0
        },
        "scenes_with_questions": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "questions",
        "blocking_assessment",
        "improves_assessment",
        "scenes_with_questions"
      ],
      "additionalProperties": false
    },
    "QuestionKind": {
      "type": "string",
      "description": "What kind of detail is missing.",
      "enum": [
        "staging",
        "coverage",
        "lines",
        "axis",
        "prop_states",
        "journey",
        "travel",
        "eyeline_target",
        "setup",
        "beats",
        "kit",
        "delivery",
        "people",
        "schedule",
        "light",
        "sound"
      ]
    },
    "QuestionPriority": {
      "type": "string",
      "description": "Whether the scene can be assessed at all without the answer.",
      "enum": [
        "blocking_assessment",
        "improves_assessment"
      ]
    }
  }
}
