{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "devon.missing_declaration_contract.schema.v1",
  "title": "DEVON Missing Declaration Contract Schema",
  "description": "Schema for declaring what is missing for an item, category or phase to reach 100 percent by observable evidence.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "missing_declaration_contract_id",
    "version",
    "status",
    "scope",
    "target_id",
    "missing_to_100",
    "blocks_execution",
    "next_required_action"
  ],
  "properties": {
    "missing_declaration_contract_id": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "const": "v1"
    },
    "status": {
      "type": "string",
      "enum": ["DRAFT", "ACTIVE", "FAIL", "MISSING"]
    },
    "scope": {
      "type": "string",
      "enum": ["phase", "category", "item", "technology", "service", "container", "port", "file", "directory", "resource"]
    },
    "target_id": {
      "type": "string",
      "minLength": 1
    },
    "missing_to_100": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/missing_record"
      }
    },
    "blocks_execution": {
      "type": "boolean"
    },
    "next_required_action": {
      "type": "string"
    }
  },
  "$defs": {
    "missing_record": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "missing_id",
        "description",
        "required_evidence",
        "blocking",
        "next_action"
      ],
      "properties": {
        "missing_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "required_evidence": {
          "type": "string"
        },
        "blocking": {
          "type": "boolean"
        },
        "next_action": {
          "type": "string"
        }
      }
    }
  }
}
