{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://postflight.co/aeronautiql/planning/v1_1/results/cache-reuse.schema.json",
  "title": "Retained native-result reuse receipt 1.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "sourceResultId",
    "sourceCommitId",
    "sourceKeyId",
    "sourceDigest",
    "targetKeyId",
    "legInputsDigest",
    "sourceCaptureDigest"
  ],
  "properties": {
    "sourceResultId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/id"
    },
    "sourceCommitId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/intentId"
    },
    "sourceKeyId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/mappingId"
    },
    "sourceDigest": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/mappingId"
    },
    "targetKeyId": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/mappingId"
    },
    "legInputsDigest": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/mappingId"
    },
    "sourceCaptureDigest": {
      "$ref": "https://postflight.co/aeronautiql/planning/v1/results/common.schema.json#/$defs/mappingId"
    }
  },
  "$defs": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "intent",
        "result",
        "resources"
      ],
      "properties": {
        "intent": {
          "$ref": "https://postflight.co/aeronautiql/planning/v1/intent/intent.schema.json"
        },
        "result": {
          "allOf": [
            {
              "$ref": "engine-result.schema.json"
            },
            {
              "not": {
                "required": [
                  "cacheReuse"
                ]
              }
            }
          ]
        },
        "resources": {
          "type": "object"
        }
      }
    }
  }
}
