{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://theamateur.co.uk/schemas/dpl/dpl.dispositions-1.schema.json",
  "title": "DPL finding dispositions (dpl.dispositions/1)",
  "description": "What `dpl disposition` writes and `dpl readiness <plan> --dispositions <file>` reads: decisions about findings (accepted, overridden or wont_fix, each with a reason, who decided and when), kept across revisions of a plan. A decision holds only while the finding's evidence hash is unchanged; when the evidence changes the finding is open again. Unknown members are refused.",
  "$comment": "Later entries for the same finding replace earlier ones; the earlier ones stay as history. `evidence_hash` is the SHA-256 of the finding's code, its entities and its evidence facts (not the plan paths, which move when a scene is added before it).",
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "const": "dpl.dispositions/1"
    },
    "dispositions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DispositionEntry"
      }
    }
  },
  "required": [
    "format",
    "dispositions"
  ],
  "additionalProperties": false,
  "$defs": {
    "DispositionEntry": {
      "type": "object",
      "description": "One decision about one finding.",
      "properties": {
        "finding_id": {
          "description": "The finding's id (f- and 12 hex digits), which names the rule and what it is about.",
          "type": "string",
          "pattern": "^f-[0-9a-f]{12}$"
        },
        "disposition": {
          "$ref": "#/$defs/DispositionKind"
        },
        "reason": {
          "description": "Why, in the decider's words. Shown whenever the finding is listed as closed.",
          "type": "string",
          "pattern": "\\S"
        },
        "at_plan_hash": {
          "description": "The revision of the plan (as dpl readiness reports it) the decision was made against.",
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "evidence_hash": {
          "description": "SHA-256 of the finding's code, its entities and its evidence values when the decision was made. The decision holds only while a finding of that id still has this hash.",
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "by": {
          "description": "Who decided: a person's name, or an agent's.",
          "type": "string",
          "pattern": "\\S"
        },
        "at": {
          "description": "When, as an ISO 8601 date and time with a zone (for example 2026-10-18T09:30:00Z).",
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
        }
      },
      "required": [
        "finding_id",
        "disposition",
        "reason",
        "at_plan_hash",
        "evidence_hash",
        "by",
        "at"
      ],
      "additionalProperties": false
    },
    "DispositionKind": {
      "type": "string",
      "description": "What was decided. Spelled accepted, overridden and wont_fix.",
      "enum": [
        "accepted",
        "overridden",
        "wont_fix"
      ]
    }
  }
}
