{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ctlsurf-com/json-schema/ctlsurf-com-template-detail-schema.json",
  "title": "TemplateDetail",
  "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/TemplateDetail",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "key": {
      "type": "string",
      "title": "Key"
    },
    "name": {
      "type": "string",
      "title": "Name"
    },
    "description": {
      "type": "string",
      "title": "Description"
    },
    "read_only": {
      "type": "boolean",
      "title": "Read Only"
    },
    "cloned_from": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cloned From"
    },
    "draft_revision": {
      "type": "integer",
      "title": "Draft Revision"
    },
    "latest_version": {
      "type": "integer",
      "title": "Latest Version"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "draft_definition": {
      "$ref": "#/$defs/OrganizationDefinition-Output"
    },
    "versions": {
      "items": {
        "$ref": "#/$defs/TemplateVersionResponse"
      },
      "type": "array",
      "title": "Versions"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id",
    "key",
    "name",
    "description",
    "read_only",
    "cloned_from",
    "draft_revision",
    "latest_version",
    "updated_at",
    "draft_definition",
    "versions"
  ],
  "$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"
    },
    "TemplateVersionResponse": {
      "properties": {
        "version": {
          "type": "integer",
          "title": "Version"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "description": {
          "type": "string",
          "title": "Description"
        },
        "definition": {
          "$ref": "#/$defs/OrganizationDefinition-Output"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version",
        "name",
        "description",
        "definition",
        "created_at"
      ],
      "title": "TemplateVersionResponse"
    }
  }
}