{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.solana-edge.composition.v1.schema.json",
  "title": "capp.solana-edge.composition.v1",
  "type": "object",
  "required": [
    "protocol",
    "sidecarId"
  ],
  "properties": {
    "protocol": {
      "const": "capp.solana-edge.composition.v1"
    },
    "sidecarId": {
      "const": "uk.capp.sidecar.solana-edge"
    },
    "mode": {
      "type": "string"
    },
    "network": {
      "type": "string"
    },
    "automatic": {
      "type": "boolean"
    },
    "selectedPeerCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10
    },
    "rule": {
      "type": "string"
    },
    "nodes": {
      "$ref": "#/$defs/nodes"
    },
    "applications": {
      "type": "array",
      "maxItems": 64,
      "items": {
        "type": "object",
        "required": [
          "componentId",
          "applicationKey",
          "edgeSelected",
          "mode",
          "nodes"
        ],
        "properties": {
          "componentId": {
            "type": "string"
          },
          "applicationKey": {
            "type": "string"
          },
          "edgeSelected": {
            "type": "boolean"
          },
          "mode": {
            "type": "string"
          },
          "nodes": {
            "$ref": "#/$defs/nodes"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "anyOf": [
    {
      "required": [
        "nodes"
      ]
    },
    {
      "required": [
        "applications"
      ]
    }
  ],
  "$defs": {
    "node": {
      "type": "object",
      "required": [
        "sidecarId",
        "selected"
      ],
      "properties": {
        "sidecarId": {
          "type": "string"
        },
        "selected": {
          "type": "boolean"
        },
        "loaded": {
          "type": "boolean"
        },
        "route": {
          "type": "string"
        },
        "providerMode": {
          "type": [
            "string",
            "null"
          ]
        },
        "network": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": [
            "object",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "nodes": {
      "type": "object",
      "required": [
        "compass",
        "circuit",
        "switchyard",
        "accord",
        "conduit",
        "sentinel",
        "latch",
        "dispatch",
        "witness",
        "arena"
      ],
      "properties": {
        "compass": {
          "$ref": "#/$defs/node"
        },
        "circuit": {
          "$ref": "#/$defs/node"
        },
        "switchyard": {
          "$ref": "#/$defs/node"
        },
        "accord": {
          "$ref": "#/$defs/node"
        },
        "conduit": {
          "$ref": "#/$defs/node"
        },
        "sentinel": {
          "$ref": "#/$defs/node"
        },
        "latch": {
          "$ref": "#/$defs/node"
        },
        "dispatch": {
          "$ref": "#/$defs/node"
        },
        "witness": {
          "$ref": "#/$defs/node"
        },
        "arena": {
          "$ref": "#/$defs/node"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
