{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frase-io/json-schema/frase-io-paginated-templates-schema.json",
  "title": "PaginatedTemplates",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frase-io-templates-api-openapi.yml#/components/schemas/PaginatedTemplates",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Template"
      }
    },
    "pagination": {
      "$ref": "#/$defs/Pagination"
    },
    "request_id": {
      "type": "string"
    }
  },
  "$defs": {
    "BoilerplateBlock": {
      "type": "object",
      "required": [
        "id",
        "position",
        "content",
        "label"
      ],
      "description": "A reusable content block that can be inserted at specific positions in generated content.",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "description": "Unique identifier for the block"
        },
        "position": {
          "type": "string",
          "enum": [
            "before_section",
            "after_section",
            "header",
            "footer"
          ],
          "description": "Where to insert the block"
        },
        "anchorSectionHeading": {
          "type": "string",
          "description": "Section heading to anchor to (for before_section/after_section positions)"
        },
        "content": {
          "type": "string",
          "maxLength": 50000,
          "description": "The boilerplate content (max 50,000 characters)"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "description": "Display label for the block"
        }
      }
    },
    "Pagination": {
      "type": "object",
      "properties": {
        "page": {
          "type": "integer"
        },
        "page_size": {
          "type": "integer"
        },
        "total": {
          "type": "integer"
        },
        "has_more": {
          "type": "boolean"
        }
      }
    },
    "Template": {
      "type": "object",
      "description": "A content template defining outline structure, boilerplate blocks, and field defaults.",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "content_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "blog",
            "guide",
            "landing",
            "product",
            "comparison"
          ]
        },
        "outline_sections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateSectionDef"
          }
        },
        "section_count": {
          "type": "integer",
          "description": "Number of sections in the outline"
        },
        "total_word_count": {
          "type": "integer",
          "description": "Sum of suggested word counts across all sections"
        },
        "boilerplate_blocks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/BoilerplateBlock"
          }
        },
        "field_defaults": {
          "allOf": [
            {
              "$ref": "#/$defs/TemplateFieldDefaults"
            }
          ],
          "nullable": true
        },
        "source_type": {
          "type": [
            "string",
            "null"
          ],
          "description": "Source from which this template was extracted"
        },
        "is_system": {
          "type": "boolean",
          "description": "Whether this is a system-provided template"
        },
        "is_default": {
          "type": "boolean",
          "description": "Whether this is the default template"
        },
        "is_enabled": {
          "type": "boolean",
          "description": "Whether this template is enabled"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "TemplateFieldDefaults": {
      "type": "object",
      "description": "Default field values applied when the template is used.",
      "properties": {
        "targetWordCount": {
          "type": "integer",
          "minimum": 0,
          "description": "Default target word count"
        },
        "metaTitleFormat": {
          "type": "string",
          "description": "Default meta title format"
        },
        "suggestedTone": {
          "type": "string",
          "description": "Default suggested tone"
        },
        "targetLanguage": {
          "type": "string",
          "description": "Default target language"
        },
        "targetCountry": {
          "type": "string",
          "description": "Default target country"
        }
      }
    },
    "TemplateSectionDef": {
      "type": "object",
      "required": [
        "heading",
        "level"
      ],
      "description": "A section definition within a template outline.",
      "properties": {
        "heading": {
          "type": "string",
          "minLength": 1,
          "description": "The section heading text"
        },
        "level": {
          "type": "integer",
          "minimum": 1,
          "maximum": 6,
          "description": "Heading level (1-6)"
        },
        "keyPoints": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": [],
          "description": "Key points to cover in this section"
        },
        "suggestedWordCount": {
          "type": "integer",
          "minimum": 0,
          "default": 200,
          "description": "Suggested word count for this section"
        },
        "isRequired": {
          "type": "boolean",
          "default": true,
          "description": "Whether this section is required"
        },
        "generationMode": {
          "type": "string",
          "enum": [
            "ai",
            "manual"
          ],
          "description": "Whether AI generates this section or user provides content"
        }
      }
    }
  }
}