{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/signvoy-com/json-schema/signvoy-com-gallery-template-dto-schema.json",
  "title": "GalleryTemplateDto",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/signvoy-com-openapi.json#/components/schemas/GalleryTemplateDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "slug": {
      "type": "string",
      "description": "Stable URL-safe identifier"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "fileName": {
      "type": "string"
    },
    "pageCount": {
      "type": "integer",
      "description": "Page count of the seed PDF. Meaningful only for `sourceKind: 'pdf'` — a document-source template has no fixed page count until it is frozen at publish."
    },
    "planTier": {
      "type": "string"
    },
    "sortOrder": {
      "type": "integer"
    },
    "sourceKind": {
      "type": "string",
      "enum": [
        "pdf",
        "document"
      ],
      "description": "`document` for content-native rich-text templates, `pdf` for templates built on an uploaded file."
    },
    "recipients": {
      "description": "Signers, with the colours their fields are drawn in.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/GalleryRecipientDto"
      }
    },
    "fieldCount": {
      "type": "integer",
      "description": "Total fields across all pages"
    },
    "previewUrl": {
      "type": "string",
      "description": "Short-lived presigned URL for the seed PDF. Only present on the detail response and only for `sourceKind: 'pdf'` — document templates are rendered client-side from `content.body`."
    },
    "content": {
      "type": "object",
      "description": "Full normalized template content: recipients, fields, rules, and (for document source) the rich-text body. Detail response only."
    }
  },
  "required": [
    "id",
    "slug",
    "name",
    "description",
    "category",
    "tags",
    "fileName",
    "pageCount",
    "planTier",
    "sortOrder",
    "sourceKind",
    "recipients",
    "fieldCount"
  ],
  "$defs": {
    "GalleryRecipientDto": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "Stable key referenced by `field.recipientKey`"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "description": "Hex colour, e.g. `#2563EB`"
        },
        "order": {
          "type": "integer",
          "description": "Signing order (0-based)"
        }
      },
      "required": [
        "key",
        "name",
        "color",
        "order"
      ]
    }
  }
}