{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/varg-ai/json-schema/varg-ai-template-schema.json",
  "title": "Template",
  "description": "A community-published render template",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/varg-ai-openapi.json#/components/schemas/Template",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "documentId": {
      "type": "string",
      "format": "uuid",
      "description": "The template's own (frozen) copy of the source document"
    },
    "sourceDocumentId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The document the author published it from"
    },
    "userId": {
      "type": "string",
      "description": "Author user id"
    },
    "description": {
      "type": "string"
    },
    "tags": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "status": {
      "type": "string",
      "description": "Moderation status. Only `approved` templates are public."
    },
    "useCount": {
      "type": "integer"
    },
    "favoriteCount": {
      "type": "integer"
    },
    "isFavorited": {
      "type": "boolean",
      "description": "Whether the calling user has favorited it"
    },
    "thumbnailObjectPosition": {
      "type": "string"
    },
    "videoObjectPosition": {
      "type": "string"
    },
    "isServiceTemplate": {
      "type": "boolean"
    },
    "previewUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Short autoplay clip; null until the preview is ready"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "document": {
      "$ref": "#/$defs/TemplateDocument"
    },
    "thumbnailUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "outputMediaUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "outputMediaType": {
      "type": [
        "string",
        "null"
      ]
    },
    "durationMs": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Output video duration in milliseconds"
    },
    "author": {
      "$ref": "#/$defs/TemplateAuthor"
    }
  },
  "$defs": {
    "TemplateAuthor": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Author user id"
        },
        "displayName": {
          "type": [
            "string",
            "null"
          ]
        },
        "avatarUrl": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "TemplateDocument": {
      "type": "object",
      "description": "The document that holds the template's TSX source",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "title": {
          "type": "string"
        },
        "content": {
          "type": [
            "string",
            "null"
          ],
          "description": "varg TSX source of the template"
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true
        },
        "kind": {
          "type": "string"
        },
        "visibility": {
          "type": "string"
        },
        "createdBy": {
          "type": "string"
        },
        "projectId": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}