{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/softsync-ai/json-schema/softsync-ai-create-document-template-dto-schema.json",
  "title": "CreateDocumentTemplateDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/softsync-ai-documents-api-openapi.yml#/components/schemas/CreateDocumentTemplateDto",
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/DocumentContentDto"
    },
    "page": {
      "$ref": "#/$defs/DocumentPageDto"
    },
    "fileName": {
      "type": "string",
      "description": "File name, may use {{ … }} (e.g. \"Invoice {{ record.number }}\")"
    },
    "outputFieldId": {
      "type": "string",
      "description": "A file field (id) on the record that also receives each new PDF"
    },
    "groupId": {
      "type": "string"
    },
    "tableId": {
      "type": "string"
    }
  },
  "required": [
    "title",
    "content"
  ],
  "$defs": {
    "DocumentContentDto": {
      "type": "object",
      "properties": {
        "blocks": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "settings": {
          "type": "object"
        },
        "pdf": {
          "type": "object"
        }
      },
      "required": [
        "blocks"
      ]
    },
    "DocumentMarginDto": {
      "type": "object",
      "properties": {
        "top": {
          "type": "number"
        },
        "right": {
          "type": "number"
        },
        "bottom": {
          "type": "number"
        },
        "left": {
          "type": "number"
        }
      }
    },
    "DocumentPageDto": {
      "type": "object",
      "properties": {
        "size": {
          "allOf": [
            {
              "$ref": "#/$defs/PaperSize"
            }
          ]
        },
        "landscape": {
          "type": "boolean"
        },
        "margin": {
          "$ref": "#/$defs/DocumentMarginDto"
        },
        "header": {
          "type": "string"
        },
        "footer": {
          "type": "string"
        },
        "pageNumbers": {
          "type": "boolean"
        }
      }
    },
    "PaperSize": {
      "type": "string",
      "enum": [
        "a4",
        "a5",
        "us-letter",
        "us-legal"
      ]
    }
  }
}