{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contract": {
      "type": "string",
      "const": "PageRuntimeProjection"
    },
    "product": {
      "type": "string",
      "enum": [
        "studio",
        "kernel"
      ]
    },
    "routes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "routeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "path": {
            "type": "string",
            "pattern": "^\\/(?!\\/)"
          }
        },
        "required": [
          "pageId",
          "routeId",
          "path"
        ],
        "additionalProperties": false
      }
    },
    "navigation": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "routeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "path": {
            "type": "string",
            "pattern": "^\\/(?!\\/)"
          },
          "label": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2}|-\\d{3})?$"
                },
                "additionalProperties": {
                  "type": "string",
                  "minLength": 1
                }
              }
            ]
          },
          "iconRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "parentPageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "order": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pinned": {
            "type": "boolean"
          }
        },
        "required": [
          "pageId",
          "routeId",
          "path",
          "label",
          "pinned"
        ],
        "additionalProperties": false
      }
    },
    "guards": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "authenticated": {
            "type": "boolean"
          },
          "permissionAllOf": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "permissionAnyOf": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "featureFlags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "execute",
                "manage-permissions"
              ]
            }
          }
        },
        "required": [
          "pageId",
          "authenticated",
          "permissionAllOf",
          "permissionAnyOf",
          "featureFlags",
          "actions"
        ],
        "additionalProperties": false
      }
    },
    "renderers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "surface": {
            "type": "string",
            "enum": [
              "page",
              "workspace",
              "view",
              "record",
              "action",
              "overlay",
              "agent"
            ]
          },
          "rendererKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "capabilityRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "version": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "string",
                    "minLength": 1
                  }
                ]
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "capabilityRefs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "version": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "string",
                      "minLength": 1
                    }
                  ]
                },
                "ownerRepo": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "kind",
                "id"
              ],
              "additionalProperties": false
            }
          },
          "providerRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "version": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "string",
                    "minLength": 1
                  }
                ]
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "binding": {
            "type": "object",
            "properties": {
              "sourceRef": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "ontologyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "projectionRef": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "stateRef": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "additionalProperties": false
          },
          "rendererConfig": {
            "type": "object",
            "properties": {
              "schemaRef": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "value": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              }
            },
            "required": [
              "schemaRef",
              "value"
            ],
            "additionalProperties": false
          },
          "workflowRef": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "version": {
                "anyOf": [
                  {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "string",
                    "minLength": 1
                  }
                ]
              },
              "ownerRepo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "pageId",
          "surface",
          "rendererKey",
          "capabilityRef",
          "capabilityRefs",
          "providerRef",
          "binding",
          "rendererConfig"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "contract",
    "product",
    "routes",
    "navigation",
    "guards",
    "renderers"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  },
  "$id": "https://schemas.infmonkeys.com/contracts/page-runtime-projection.schema.json",
  "title": "page-runtime-projection"
}
