{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ctlsurf-com/json-schema/ctlsurf-com-authoring-structure-schema.json",
  "title": "AuthoringStructure",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ctlsurf-com-project-organization-api-openapi.yml#/components/schemas/AuthoringStructure",
  "properties": {
    "project_root_id": {
      "type": "string",
      "format": "uuid",
      "title": "Project Root Id"
    },
    "binding_revision": {
      "type": "integer",
      "title": "Binding Revision"
    },
    "template_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Template Id"
    },
    "template_version": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Template Version"
    },
    "template_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Template Name"
    },
    "source": {
      "type": "string",
      "enum": [
        "active",
        "selected",
        "none"
      ],
      "title": "Source"
    },
    "can_create": {
      "type": "boolean",
      "title": "Can Create"
    },
    "sections": {
      "items": {
        "$ref": "#/$defs/AuthoringSection"
      },
      "type": "array",
      "title": "Sections"
    },
    "user_override_supported": {
      "type": "boolean",
      "title": "User Override Supported",
      "default": true
    },
    "semantic_review_available": {
      "type": "boolean",
      "title": "Semantic Review Available",
      "default": false
    },
    "instructions": {
      "type": "string",
      "title": "Instructions"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "project_root_id",
    "binding_revision",
    "template_id",
    "template_version",
    "template_name",
    "source",
    "can_create",
    "sections",
    "instructions"
  ],
  "$defs": {
    "AuthoringSection": {
      "properties": {
        "key": {
          "type": "string",
          "title": "Key"
        },
        "label": {
          "type": "string",
          "title": "Label"
        },
        "purpose": {
          "type": "string",
          "title": "Purpose"
        },
        "path": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Path"
        },
        "parent_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Parent Key"
        },
        "page_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Page Id"
        },
        "anchor_state": {
          "type": "string",
          "enum": [
            "unbound",
            "ready",
            "needs_repair"
          ],
          "title": "Anchor State",
          "default": "unbound"
        },
        "inclusion_examples": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Inclusion Examples"
        },
        "exclusion_examples": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Exclusion Examples"
        },
        "rules": {
          "items": {
            "$ref": "#/$defs/OrganizationRule"
          },
          "type": "array",
          "title": "Rules"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "label",
        "purpose",
        "path",
        "parent_key"
      ],
      "title": "AuthoringSection"
    },
    "OrganizationRule": {
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9_.-]*$",
          "title": "Key"
        },
        "section_key": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9_.-]*$",
          "title": "Section Key"
        },
        "content_kinds": {
          "items": {
            "type": "string",
            "maxLength": 120,
            "minLength": 1
          },
          "type": "array",
          "maxItems": 30,
          "title": "Content Kinds"
        },
        "required_metadata": {
          "items": {
            "type": "string",
            "maxLength": 120,
            "minLength": 1,
            "pattern": "^[a-z][a-z0-9_.-]*$"
          },
          "type": "array",
          "maxItems": 30,
          "title": "Required Metadata"
        },
        "reason": {
          "type": "string",
          "maxLength": 2000,
          "minLength": 1,
          "title": "Reason"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "section_key",
        "reason"
      ],
      "title": "OrganizationRule"
    }
  }
}