{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ctlsurf-com/json-schema/ctlsurf-com-template-draft-update-schema.json",
  "title": "TemplateDraftUpdate",
  "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/TemplateDraftUpdate",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 120,
      "minLength": 1,
      "title": "Name"
    },
    "description": {
      "type": "string",
      "maxLength": 4000,
      "title": "Description",
      "default": ""
    },
    "definition": {
      "$ref": "#/$defs/OrganizationDefinition-Input"
    },
    "expected_draft_revision": {
      "type": "integer",
      "minimum": 1.0,
      "title": "Expected Draft Revision"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "expected_draft_revision"
  ],
  "$defs": {
    "OrganizationDefinition-Input": {
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "title": "Schema Version",
          "default": 1
        },
        "nodes": {
          "items": {
            "$ref": "#/$defs/OrganizationSection-Input"
          },
          "type": "array",
          "maxItems": 200,
          "title": "Nodes"
        },
        "rules": {
          "items": {
            "$ref": "#/$defs/OrganizationRule"
          },
          "type": "array",
          "maxItems": 200,
          "title": "Rules"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "OrganizationDefinition"
    },
    "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"
    },
    "OrganizationSection-Input": {
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9_.-]*$",
          "title": "Key"
        },
        "label": {
          "type": "string",
          "maxLength": 120,
          "minLength": 1,
          "title": "Label"
        },
        "purpose": {
          "type": "string",
          "maxLength": 2000,
          "minLength": 1,
          "title": "Purpose"
        },
        "inclusion_examples": {
          "items": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1
          },
          "type": "array",
          "maxItems": 20,
          "title": "Inclusion Examples"
        },
        "exclusion_examples": {
          "items": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1
          },
          "type": "array",
          "maxItems": 20,
          "title": "Exclusion Examples"
        },
        "children": {
          "items": {
            "$ref": "#/$defs/OrganizationSection-Input"
          },
          "type": "array",
          "maxItems": 200,
          "title": "Children"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "label",
        "purpose"
      ],
      "title": "OrganizationSection"
    }
  }
}