{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.cuddler.dev/standards/document-role/template/v1.0.0/cuddler.template.authoring-profile.schema.1.0.0.json",
  "title": "Cuddler Template Authoring Profile",
  "allOf": [
    {
      "$ref": "https://json-schema.org/draft/2020-12/schema"
    },
    {
      "type": "object",
      "required": [
        "$schema",
        "$id",
        "title",
        "for-ai",
        "cuddler",
        "allOf"
      ],
      "properties": {
        "$schema": {
          "const": "https://json-schema.org/draft/2020-12/schema"
        },
        "$id": {
          "type": "string",
          "pattern": "^https://www\\.cuddler\\.dev/standards/artifact-definitions/[a-z][a-z0-9-]{2,62}/(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?/template\\.schema\\.json$"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "cuddler": {
          "$ref": "#/$defs/CuddlerMetadata"
        },
        "$defs": {
          "type": "object",
          "minProperties": 1
        },
        "allOf": {
          "type": "array",
          "minItems": 1,
          "contains": {
            "type": "object",
            "required": [
              "$ref"
            ],
            "properties": {
              "$ref": {
                "enum": [
                  "https://www.cuddler.dev/standards/document-role/template/v1.0.0/commonmark-gfm-markdig.schema.1.0.0.json",
                  "https://www.cuddler.dev/standards/document-role/template/v1.0.0/cuddler.template.base.defs.schema.1.0.0.json#/$defs/MarkdownDocument"
                ]
              }
            }
          }
        },
        "for-ai": {
          "$ref": "#/$defs/ForAiArray"
        }
      }
    }
  ],
  "$defs": {
    "KebabCaseId": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{2,62}$"
    },
    "SemVer": {
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
    },
    "MimeType": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*/[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*$"
    },
    "CuddlerOutput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "primaryContentType"
      ],
      "properties": {
        "primaryContentType": {
          "$ref": "#/$defs/MimeType"
        },
        "supportedContentTypes": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/MimeType"
          }
        }
      }
    },
    "CuddlerMetadata": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "specVersion",
        "documentTypeId",
        "schemaVersion",
        "artifactType",
        "status",
        "publisher",
        "sourceUrl",
        "attributionNotice",
        "governingDomainSpecification",
        "governingArtifactSpecification",
        "dataSchema",
        "output"
      ],
      "properties": {
        "specVersion": {
          "const": "1.0.0"
        },
        "documentTypeId": {
          "$ref": "#/$defs/KebabCaseId"
        },
        "schemaVersion": {
          "$ref": "#/$defs/SemVer"
        },
        "artifactType": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "const": "Public normative publication"
        },
        "publisher": {
          "type": "string",
          "minLength": 1
        },
        "sourceUrl": {
          "type": "string",
          "pattern": "^https://www\\.cuddler\\.dev/standards/artifact-definitions/[a-z][a-z0-9-]{2,62}/(?:(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)/template\\.schema\\.json)?$"
        },
        "attributionNotice": {
          "type": "string",
          "minLength": 1
        },
        "governingDomainSpecification": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "title",
            "url"
          ],
          "properties": {
            "title": {
              "type": "string",
              "minLength": 1
            },
            "url": {
              "type": "string",
              "pattern": "^https://www\\.cuddler\\.dev/standards/document-role/[a-z][a-z0-9-]*/v\\d+\\.\\d+\\.\\d+/$"
            }
          }
        },
        "governingArtifactSpecification": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "title",
            "version",
            "url"
          ],
          "properties": {
            "title": {
              "type": "string",
              "const": "Cuddler Artifact Specification"
            },
            "version": {
              "$ref": "#/$defs/SemVer"
            },
            "url": {
              "type": "string",
              "pattern": "^https://www\\.cuddler\\.dev/standards/artifact-specification/v\\d+\\.\\d+\\.\\d+/$"
            }
          }
        },
        "dataSchema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "uri"
          ],
          "properties": {
            "uri": {
              "type": "string",
              "pattern": "^https://www\\.cuddler\\.dev/standards/artifact-definitions/[a-z][a-z0-9-]{2,62}/(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?/data\\.schema\\.json$"
            }
          }
        },
        "output": {
          "$ref": "#/$defs/CuddlerOutput"
        }
      }
    },
    "ForAiEntry": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "instruction",
        "input",
        "output"
      ],
      "properties": {
        "instruction": {
          "type": "string",
          "minLength": 1
        },
        "input": {
          "type": "string"
        },
        "output": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ForAiArray": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/ForAiEntry"
      }
    }
  },
  "for-ai": [
    {
      "instruction": "Use this guidance when preparing a valid value for this schema node.",
      "input": "",
      "output": "Machine-readable authoring profile for Cuddler Template Artifact Definitions. A conforming template.schema.json must anchor its template-instance contract to the published CommonMark plus GFM Markdig markdown AST support schema and then narrow that markdown document shape to the artifact family's exact template structure."
    }
  ]
}


