{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/selection-state.schema.json",
  "title": "dpone GitOps workload selection state",
  "type": "object",
  "required": [
    "schema",
    "state_fingerprint",
    "nodes"
  ],
  "additionalProperties": false,
  "properties": {
    "schema": {
      "const": "dpone.selection-state.v1"
    },
    "state_fingerprint": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "nodes": {
      "type": "array",
      "maxItems": 1000,
      "items": {
        "$ref": "#/$defs/state_node"
      }
    }
  },
  "$defs": {
    "sha256": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "state_node": {
      "type": "object",
      "required": [
        "id",
        "semantic_fingerprint",
        "graph_fingerprint"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "semantic_fingerprint": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "graph_fingerprint": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        }
      }
    }
  }
}
