{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "apiVersion": {
      "const": "testing.aiwg.io/v1"
    },
    "kind": {
      "const": "TestNormalizationPlan"
    },
    "metadata": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "createdAt": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z$"
        },
        "toolVersion": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "name",
        "createdAt",
        "toolVersion"
      ]
    },
    "spec": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "root": {
          "type": "string",
          "minLength": 1
        },
        "purpose": {
          "type": "string"
        },
        "changes": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1
              },
              "before": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "content": {
                        "type": "null"
                      },
                      "hash": {
                        "type": "null"
                      },
                      "mode": {
                        "type": "null"
                      }
                    },
                    "required": [
                      "content",
                      "hash",
                      "mode"
                    ]
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "content": {
                        "type": "string"
                      },
                      "hash": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "mode": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 511
                      }
                    },
                    "required": [
                      "content",
                      "hash",
                      "mode"
                    ]
                  }
                ]
              },
              "after": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "content": {
                        "type": "null"
                      },
                      "hash": {
                        "type": "null"
                      },
                      "mode": {
                        "type": "null"
                      }
                    },
                    "required": [
                      "content",
                      "hash",
                      "mode"
                    ]
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "content": {
                        "type": "string"
                      },
                      "hash": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "mode": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 511
                      }
                    },
                    "required": [
                      "content",
                      "hash",
                      "mode"
                    ]
                  }
                ]
              }
            },
            "required": [
              "path",
              "before",
              "after"
            ]
          },
          "maxItems": 1000
        },
        "planHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "root",
        "purpose",
        "changes",
        "planHash"
      ]
    }
  },
  "required": [
    "apiVersion",
    "kind",
    "metadata",
    "spec"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://aiwg.io/schemas/testing/normalization-plan.v1.schema.json",
  "title": "TestNormalizationPlan"
}
