{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ctlsurf-com/json-schema/ctlsurf-com-project-organization-response-schema.json",
  "title": "ProjectOrganizationResponse",
  "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/ProjectOrganizationResponse",
  "properties": {
    "root_page_id": {
      "type": "string",
      "format": "uuid",
      "title": "Root Page Id"
    },
    "binding_revision": {
      "type": "integer",
      "title": "Binding Revision"
    },
    "state": {
      "type": "string",
      "enum": [
        "off",
        "paused",
        "watching"
      ],
      "title": "State"
    },
    "enabled": {
      "type": "boolean",
      "title": "Enabled"
    },
    "paused": {
      "type": "boolean",
      "title": "Paused"
    },
    "mode": {
      "type": "string",
      "const": "warn",
      "title": "Mode"
    },
    "active_template": {
      "anyOf": [
        {
          "$ref": "#/$defs/SelectedTemplate"
        },
        {
          "type": "null"
        }
      ]
    },
    "candidate_template": {
      "anyOf": [
        {
          "$ref": "#/$defs/SelectedTemplate"
        },
        {
          "type": "null"
        }
      ]
    },
    "can_manage": {
      "type": "boolean",
      "title": "Can Manage"
    },
    "arrangement_available": {
      "type": "boolean",
      "title": "Arrangement Available",
      "default": true
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "root_page_id",
    "binding_revision",
    "state",
    "enabled",
    "paused",
    "mode",
    "active_template",
    "candidate_template",
    "can_manage"
  ],
  "$defs": {
    "OrganizationDefinition-Output": {
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "title": "Schema Version",
          "default": 1
        },
        "nodes": {
          "items": {
            "$ref": "#/$defs/OrganizationSection-Output"
          },
          "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-Output": {
      "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-Output"
          },
          "type": "array",
          "maxItems": 200,
          "title": "Children"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "key",
        "label",
        "purpose"
      ],
      "title": "OrganizationSection"
    },
    "SelectedTemplate": {
      "properties": {
        "template_id": {
          "type": "string",
          "format": "uuid",
          "title": "Template Id"
        },
        "version": {
          "type": "integer",
          "minimum": 1.0,
          "title": "Version"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "definition": {
          "$ref": "#/$defs/OrganizationDefinition-Output"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "template_id",
        "version",
        "name",
        "definition"
      ],
      "title": "SelectedTemplate"
    }
  }
}