{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.1/applications/proposal.schema.json",
  "title": "Proposal",
  "description": "A change an application offers to a model's records, as commands of Part V: <application>/<model>/proposals/<id>.json, a kept file (spec Part VI, 8.7). Written by hand from the text, not generated. A reader also reads the earlier id openeik-proposal/0.1-proposal as this format.",
  "type": "object",
  "properties": {
    "format": {
      "enum": [
        "openeik-proposal/0.1",
        "openeik-proposal/0.1-proposal"
      ]
    },
    "intent": {
      "type": "string",
      "minLength": 1
    },
    "base": {
      "type": "object",
      "properties": {
        "version": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$"
            },
            {
              "type": "null"
            }
          ]
        },
        "records": {
          "type": "object",
          "propertyNames": {
            "minLength": 1
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "hash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "revision": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "hash",
              "revision"
            ],
            "x-eik-closed": true
          }
        }
      },
      "required": [
        "version",
        "records"
      ],
      "x-eik-closed": true
    },
    "by": {
      "type": "object",
      "properties": {
        "app": {
          "type": "string",
          "minLength": 1
        },
        "person": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "app",
        "person"
      ],
      "x-eik-closed": true
    },
    "commands": {
      "description": "A batch of commands of Part V, in order. This schema checks only that each command is an object that names its kind.",
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "kind"
        ]
      }
    },
    "dryRun": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "properties": {
            "at": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
            },
            "by": {
              "type": "string",
              "minLength": 1
            },
            "ok": {
              "type": "boolean"
            }
          },
          "required": [
            "at",
            "by",
            "ok"
          ],
          "x-eik-closed": true
        }
      ]
    },
    "evidence": {
      "type": "object",
      "x-eik-application": true
    }
  },
  "required": [
    "format",
    "intent",
    "base",
    "by",
    "commands"
  ],
  "x-eik-closed": true
}
