{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contract": {
      "type": "string",
      "const": "PageRuntimeDescriptor"
    },
    "page": {
      "type": "object",
      "properties": {
        "contract": {
          "type": "string",
          "const": "PageDefinition"
        },
        "pageId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "ownerRepo": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "title": {
          "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
              }
            }
          ]
        },
        "pageType": {
          "type": "string",
          "enum": [
            "page",
            "workspace",
            "view",
            "record",
            "action",
            "overlay",
            "agent",
            "process",
            "log",
            "chat",
            "preview",
            "api",
            "enhanced",
            "agent-chat",
            "agent-config",
            "agent-log",
            "design-board",
            "global-design-board",
            "iframe"
          ]
        },
        "ownership": {
          "type": "object",
          "properties": {
            "teamId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "creatorRef": {
              "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
            },
            "studioId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "builtIn": {
              "type": "boolean"
            }
          },
          "required": [
            "builtIn"
          ],
          "additionalProperties": false
        },
        "record": {
          "type": "object",
          "properties": {
            "createdTimestamp": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "updatedTimestamp": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "deleted": {
              "default": false,
              "type": "boolean"
            }
          },
          "required": [
            "deleted"
          ],
          "additionalProperties": false
        },
        "surface": {
          "type": "string",
          "enum": [
            "page",
            "workspace",
            "view",
            "record",
            "action",
            "overlay",
            "agent"
          ]
        },
        "routeId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "routePath": {
          "type": "string",
          "pattern": "^\\/(?!\\/)"
        },
        "legacyRoutePolicy": {
          "type": "object",
          "properties": {
            "contract": {
              "type": "string",
              "const": "LegacyRoutePolicy"
            },
            "schemaVersion": {
              "type": "number",
              "const": 1
            },
            "fallback": {
              "type": "string",
              "enum": [
                "allowed",
                "forbidden"
              ]
            },
            "restoration": {
              "type": "string",
              "enum": [
                "allowed",
                "forbidden"
              ]
            }
          },
          "required": [
            "contract",
            "schemaVersion",
            "fallback",
            "restoration"
          ],
          "additionalProperties": false
        },
        "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": {
          "default": [],
          "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
          }
        },
        "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
        },
        "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
        },
        "access": {
          "type": "object",
          "properties": {
            "actions": {
              "default": [],
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "read",
                  "write",
                  "execute",
                  "manage-permissions"
                ]
              }
            }
          },
          "required": [
            "actions"
          ],
          "additionalProperties": false
        },
        "input": {
          "type": "object",
          "properties": {
            "schemaRef": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "schemaRef"
          ],
          "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
        },
        "navigation": {
          "type": "object",
          "properties": {
            "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
            },
            "hidden": {
              "default": false,
              "type": "boolean"
            },
            "pinned": {
              "default": false,
              "type": "boolean"
            }
          },
          "required": [
            "label",
            "hidden",
            "pinned"
          ],
          "additionalProperties": false
        },
        "visibility": {
          "type": "object",
          "properties": {
            "authenticated": {
              "default": true,
              "type": "boolean"
            },
            "permissionAllOf": {
              "default": [],
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "permissionAnyOf": {
              "default": [],
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "featureFlags": {
              "default": [],
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "productContexts": {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "studio",
                  "kernel"
                ]
              }
            }
          },
          "required": [
            "authenticated",
            "permissionAllOf",
            "permissionAnyOf",
            "featureFlags",
            "productContexts"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "contract",
        "pageId",
        "ownerRepo",
        "title",
        "pageType",
        "ownership",
        "record",
        "surface",
        "routeId",
        "routePath",
        "rendererKey",
        "capabilityRef",
        "capabilityRefs",
        "binding",
        "access",
        "rendererConfig",
        "navigation",
        "visibility"
      ],
      "additionalProperties": false
    },
    "nodeId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "parentNodeId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "slot": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "semanticRef": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "dataContextRef": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "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
    },
    "surface": {
      "type": "object",
      "properties": {
        "frameOwner": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "tone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "density": {
          "default": "default",
          "type": "string",
          "enum": [
            "compact",
            "default",
            "comfortable"
          ]
        }
      },
      "required": [
        "frameOwner",
        "density"
      ],
      "additionalProperties": false
    },
    "scroll": {
      "type": "object",
      "properties": {
        "owner": {
          "type": "string",
          "enum": [
            "page",
            "surface",
            "provider"
          ]
        },
        "axis": {
          "type": "string",
          "enum": [
            "x",
            "y",
            "both",
            "none"
          ]
        },
        "restoreKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "virtualized": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "owner",
        "axis",
        "virtualized"
      ],
      "additionalProperties": false
    },
    "activation": {
      "type": "string",
      "enum": [
        "navigate",
        "select",
        "drawer",
        "modal",
        "fullscreen"
      ]
    },
    "lifecycle": {
      "type": "object",
      "properties": {
        "mountPolicy": {
          "type": "string",
          "enum": [
            "always",
            "when-visible",
            "when-active"
          ]
        },
        "queryPolicy": {
          "type": "string",
          "enum": [
            "always",
            "when-visible",
            "when-active",
            "manual"
          ]
        },
        "deepLink": {
          "type": "boolean"
        },
        "focusReturn": {
          "type": "boolean"
        }
      },
      "required": [
        "mountPolicy",
        "queryPolicy",
        "deepLink",
        "focusReturn"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "contract",
    "page",
    "nodeId",
    "surface",
    "scroll",
    "activation",
    "lifecycle"
  ],
  "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-descriptor.schema.json",
  "title": "page-runtime-descriptor"
}
