{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://postflight.co/aeronautiql/planning/v1_1/edits/command.schema.json",
  "title": "Planning edit command 1.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "commandId",
    "documentId",
    "baseCommitId",
    "issuedAt",
    "expiresAt",
    "origin",
    "operation"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.1"
    },
    "commandId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/properties/commandId"
    },
    "documentId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/properties/documentId"
    },
    "baseCommitId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/properties/baseCommitId"
    },
    "issuedAt": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/properties/issuedAt"
    },
    "expiresAt": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/properties/expiresAt"
    },
    "origin": {
      "oneOf": [
        {
          "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/$defs/editorOrigin"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "capture"
          ],
          "properties": {
            "kind": {
              "const": "map"
            },
            "capture": {
              "$ref": "#/$defs/capture"
            }
          }
        }
      ]
    },
    "operation": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/properties/operation"
    }
  },
  "$defs": {
    "capture": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "legId",
        "resolutionMappingId",
        "editMappingId",
        "context",
        "hit"
      ],
      "properties": {
        "legId": {
          "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/$defs/id"
        },
        "resolutionMappingId": {
          "$ref": "https://postflight.co/aeronautiql/planning/v1_1/edits/mapping.schema.json#/properties/resolutionMappingId"
        },
        "editMappingId": {
          "$ref": "https://postflight.co/aeronautiql/planning/v1_1/edits/mapping.schema.json#/properties/editMappingId"
        },
        "context": {
          "$ref": "https://postflight.co/aeronautiql/planning/v1_1/edits/mapping.schema.json#/$defs/context"
        },
        "hit": {
          "$ref": "https://postflight.co/aeronautiql/planning/v1/edits/command.schema.json#/$defs/capture/properties/hit"
        }
      }
    }
  }
}
