{
  "$defs": {
    "ArtifactReference": {
      "additionalProperties": false,
      "properties": {
        "artifact_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Artifact Id",
          "type": "string"
        },
        "media_type": {
          "maxLength": 128,
          "minLength": 3,
          "title": "Media Type",
          "type": "string"
        },
        "relative_path": {
          "maxLength": 512,
          "minLength": 1,
          "title": "Relative Path",
          "type": "string"
        },
        "sha256": {
          "pattern": "^[0-9a-f]{64}$",
          "title": "Sha256",
          "type": "string"
        },
        "size_bytes": {
          "minimum": 0,
          "title": "Size Bytes",
          "type": "integer"
        }
      },
      "required": [
        "artifact_id",
        "media_type",
        "relative_path",
        "sha256",
        "size_bytes"
      ],
      "title": "ArtifactReference",
      "type": "object"
    },
    "EngineeringDomain": {
      "enum": [
        "system",
        "mission",
        "environment",
        "mass",
        "power",
        "thermal",
        "propulsion",
        "adcs",
        "communications",
        "launch",
        "lifetime",
        "cost",
        "geometry",
        "placement",
        "deployables",
        "operations"
      ],
      "title": "EngineeringDomain",
      "type": "string"
    },
    "IndexedInput": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "$ref": "#/$defs/ArtifactReference"
        },
        "role": {
          "$ref": "#/$defs/InputRole"
        }
      },
      "required": [
        "role",
        "reference"
      ],
      "title": "IndexedInput",
      "type": "object"
    },
    "IndexedResource": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "$ref": "#/$defs/ArtifactReference"
        },
        "role_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Role Id",
          "type": "string"
        },
        "source_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Source Id",
          "type": "string"
        }
      },
      "required": [
        "role_id",
        "source_id",
        "reference"
      ],
      "title": "IndexedResource",
      "type": "object"
    },
    "IndexedSchema": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "$ref": "#/$defs/ArtifactReference"
        },
        "schema_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Schema Id",
          "type": "string"
        }
      },
      "required": [
        "schema_id",
        "reference"
      ],
      "title": "IndexedSchema",
      "type": "object"
    },
    "InputRole": {
      "enum": [
        "mission",
        "spacecraft",
        "study",
        "resolved_project"
      ],
      "title": "InputRole",
      "type": "string"
    },
    "PlannedResult": {
      "additionalProperties": false,
      "properties": {
        "domain": {
          "$ref": "#/$defs/EngineeringDomain"
        },
        "required": {
          "default": true,
          "title": "Required",
          "type": "boolean"
        },
        "result_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Result Id",
          "type": "string"
        }
      },
      "required": [
        "result_id",
        "domain"
      ],
      "title": "PlannedResult",
      "type": "object"
    },
    "ProducerIdentity": {
      "additionalProperties": false,
      "properties": {
        "build_revision": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Build Revision"
        },
        "producer_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Producer Id",
          "type": "string"
        },
        "producer_version": {
          "maxLength": 64,
          "minLength": 1,
          "title": "Producer Version",
          "type": "string"
        }
      },
      "required": [
        "producer_id",
        "producer_version"
      ],
      "title": "ProducerIdentity",
      "type": "object"
    },
    "RunLifecycle": {
      "enum": [
        "running",
        "completed",
        "failed",
        "incomplete",
        "cancelled"
      ],
      "title": "RunLifecycle",
      "type": "string"
    },
    "SourceDigest": {
      "additionalProperties": false,
      "properties": {
        "locator": {
          "maxLength": 512,
          "minLength": 1,
          "title": "Locator",
          "type": "string"
        },
        "sha256": {
          "pattern": "^[0-9a-f]{64}$",
          "title": "Sha256",
          "type": "string"
        },
        "source_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Source Id",
          "type": "string"
        },
        "source_kind": {
          "$ref": "#/$defs/SourceKind"
        }
      },
      "required": [
        "source_id",
        "source_kind",
        "locator",
        "sha256"
      ],
      "title": "SourceDigest",
      "type": "object"
    },
    "SourceKind": {
      "enum": [
        "document",
        "project_resource",
        "packaged_resource",
        "schema_manifest",
        "metric_registry"
      ],
      "title": "SourceKind",
      "type": "string"
    }
  },
  "$id": "urn:sindri:contracts:1.0.0:run-manifest",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "application": {
      "$ref": "#/$defs/ProducerIdentity"
    },
    "artifact_index": {
      "$ref": "#/$defs/ArtifactReference"
    },
    "completed_at_utc": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Completed At Utc"
    },
    "contract_suite": {
      "const": "sindri.contracts",
      "default": "sindri.contracts",
      "title": "Contract Suite",
      "type": "string"
    },
    "contract_version": {
      "const": "1.0.0",
      "default": "1.0.0",
      "title": "Contract Version",
      "type": "string"
    },
    "created_at_utc": {
      "title": "Created At Utc",
      "type": "string"
    },
    "execution_index": {
      "anyOf": [
        {
          "$ref": "#/$defs/ArtifactReference"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "input_snapshot_sha256": {
      "pattern": "^[0-9a-f]{64}$",
      "title": "Input Snapshot Sha256",
      "type": "string"
    },
    "inputs": {
      "items": {
        "$ref": "#/$defs/IndexedInput"
      },
      "minItems": 4,
      "title": "Inputs",
      "type": "array"
    },
    "journal_generation": {
      "anyOf": [
        {
          "minimum": 0,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Journal Generation"
    },
    "lifecycle": {
      "$ref": "#/$defs/RunLifecycle"
    },
    "manifest_version": {
      "default": 2,
      "enum": [
        1,
        2
      ],
      "title": "Manifest Version",
      "type": "integer"
    },
    "planned_results": {
      "default": [],
      "items": {
        "$ref": "#/$defs/PlannedResult"
      },
      "title": "Planned Results",
      "type": "array"
    },
    "resources": {
      "default": [],
      "items": {
        "$ref": "#/$defs/IndexedResource"
      },
      "title": "Resources",
      "type": "array"
    },
    "result_index": {
      "$ref": "#/$defs/ArtifactReference"
    },
    "run_id": {
      "maxLength": 128,
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
      "title": "Run Id",
      "type": "string"
    },
    "schema_kind": {
      "const": "run_manifest",
      "default": "run_manifest",
      "title": "Schema Kind",
      "type": "string"
    },
    "schemas": {
      "items": {
        "$ref": "#/$defs/IndexedSchema"
      },
      "minItems": 1,
      "title": "Schemas",
      "type": "array"
    },
    "seed": {
      "title": "Seed",
      "type": "integer"
    },
    "snapshot_id": {
      "maxLength": 128,
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
      "title": "Snapshot Id",
      "type": "string"
    },
    "source_digests": {
      "items": {
        "$ref": "#/$defs/SourceDigest"
      },
      "minItems": 1,
      "title": "Source Digests",
      "type": "array"
    },
    "study_id": {
      "maxLength": 128,
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
      "title": "Study Id",
      "type": "string"
    }
  },
  "required": [
    "run_id",
    "study_id",
    "snapshot_id",
    "input_snapshot_sha256",
    "application",
    "seed",
    "lifecycle",
    "created_at_utc",
    "inputs",
    "schemas",
    "source_digests",
    "result_index",
    "artifact_index"
  ],
  "title": "RunManifest",
  "type": "object",
  "x-sindri-contract-suite": "sindri.contracts",
  "x-sindri-contract-version": "1.0.0"
}
