{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "/schemas/3.0.0-rc.3/creative/preview-creative-request.json",
  "title": "Preview Creative Request",
  "description": "Request to generate previews of one or more creative manifests. Accepts either a single creative request or an array of requests for batch processing.",
  "oneOf": [
    {
      "type": "object",
      "description": "Single creative preview request",
      "properties": {
        "request_type": {
          "type": "string",
          "const": "single",
          "description": "Discriminator indicating this is a single preview request"
        },
        "format_id": {
          "$ref": "/schemas/3.0.0-rc.3/core/format-id.json",
          "description": "Format identifier for rendering the preview. Optional — defaults to creative_manifest.format_id if omitted."
        },
        "creative_manifest": {
          "$ref": "/schemas/3.0.0-rc.3/core/creative-manifest.json",
          "description": "Complete creative manifest with all required assets for the format."
        },
        "inputs": {
          "type": "array",
          "description": "Array of input sets for generating multiple preview variants. Each input set defines macros and context values for one preview rendering. If not provided, creative agent will generate default previews.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Human-readable name for this input set (e.g., 'Sunny morning on mobile', 'Evening podcast ad', 'Desktop dark mode')"
              },
              "macros": {
                "type": "object",
                "description": "Macro values to use for this preview. Supports all universal macros from the format's supported_macros list. See docs/creative/universal-macros.md for available macros.",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "context_description": {
                "type": "string",
                "description": "Natural language description of the context for AI-generated content (e.g., 'User just searched for running shoes', 'Podcast discussing weather patterns', 'Article about electric vehicles')"
              }
            },
            "required": [
              "name"
            ],
            "additionalProperties": true
          },
          "minItems": 1
        },
        "template_id": {
          "type": "string",
          "description": "Specific template ID for custom format rendering"
        },
        "quality": {
          "$ref": "/schemas/3.0.0-rc.3/enums/creative-quality.json",
          "description": "Render quality for the preview. 'draft' produces fast, lower-fidelity renderings for rapid iteration. 'production' produces full-quality renderings for final review. If omitted, the creative agent uses its own default."
        },
        "output_format": {
          "$ref": "/schemas/3.0.0-rc.3/enums/preview-output-format.json",
          "default": "url",
          "description": "Output format for previews. 'url' returns preview_url (iframe-embeddable URL), 'html' returns preview_html (raw HTML for direct embedding). Default: 'url' for backward compatibility."
        },
        "item_limit": {
          "type": "integer",
          "minimum": 1,
          "description": "Maximum number of catalog items to render in the preview. For catalog-driven generative formats, caps how many items are rendered per preview variant. When item_limit exceeds the format's max_items, the creative agent SHOULD use the lesser of the two. Ignored when the manifest contains no catalog assets. Creative agents SHOULD default to a reasonable sample when omitted and the catalog is large."
        },
        "context": {
          "$ref": "/schemas/3.0.0-rc.3/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.0.0-rc.3/core/ext.json"
        }
      },
      "required": [
        "request_type",
        "creative_manifest"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "description": "Batch preview request for multiple creatives (5-10x faster than individual calls)",
      "properties": {
        "request_type": {
          "type": "string",
          "const": "batch",
          "description": "Discriminator indicating this is a batch preview request"
        },
        "requests": {
          "type": "array",
          "description": "Array of preview requests (1-50 items). Each follows the single request structure.",
          "items": {
            "type": "object",
            "properties": {
              "format_id": {
                "$ref": "/schemas/3.0.0-rc.3/core/format-id.json",
                "description": "Format identifier for rendering the preview. Optional — defaults to creative_manifest.format_id if omitted."
              },
              "creative_manifest": {
                "$ref": "/schemas/3.0.0-rc.3/core/creative-manifest.json",
                "description": "Complete creative manifest with all required assets."
              },
              "inputs": {
                "type": "array",
                "description": "Array of input sets for generating multiple preview variants",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Human-readable name for this input set"
                    },
                    "macros": {
                      "type": "object",
                      "description": "Macro values to use for this preview",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "context_description": {
                      "type": "string",
                      "description": "Natural language description of the context for AI-generated content"
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "additionalProperties": true
                },
                "minItems": 1
              },
              "template_id": {
                "type": "string",
                "description": "Specific template ID for custom format rendering"
              },
              "quality": {
                "$ref": "/schemas/3.0.0-rc.3/enums/creative-quality.json",
                "description": "Render quality for this preview. 'draft' produces fast, lower-fidelity renderings. 'production' produces full-quality renderings. Overrides any batch-level default."
              },
              "output_format": {
                "$ref": "/schemas/3.0.0-rc.3/enums/preview-output-format.json",
                "default": "url",
                "description": "Output format for this preview. 'url' returns preview_url, 'html' returns preview_html."
              },
              "item_limit": {
                "type": "integer",
                "minimum": 1,
                "description": "Maximum number of catalog items to render in this preview."
              }
            },
            "required": ["creative_manifest"],
            "additionalProperties": true
          },
          "minItems": 1,
          "maxItems": 50
        },
        "quality": {
          "$ref": "/schemas/3.0.0-rc.3/enums/creative-quality.json",
          "description": "Default render quality for all requests in this batch. Individual requests can override this. 'draft' produces fast, lower-fidelity renderings. 'production' produces full-quality renderings."
        },
        "output_format": {
          "$ref": "/schemas/3.0.0-rc.3/enums/preview-output-format.json",
          "default": "url",
          "description": "Default output format for all requests in this batch. Individual requests can override this. 'url' returns preview_url (iframe-embeddable URL), 'html' returns preview_html (raw HTML for direct embedding)."
        },
        "context": {
          "$ref": "/schemas/3.0.0-rc.3/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.0.0-rc.3/core/ext.json"
        }
      },
      "required": [
        "request_type",
        "requests"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "description": "Variant preview request - retrieve a post-flight preview of a specific creative variant that was served during delivery",
      "properties": {
        "request_type": {
          "type": "string",
          "const": "variant",
          "description": "Discriminator indicating this is a variant preview request"
        },
        "variant_id": {
          "type": "string",
          "description": "Platform-assigned variant identifier from get_creative_delivery response"
        },
        "creative_id": {
          "type": "string",
          "description": "Creative identifier for context"
        },
        "output_format": {
          "$ref": "/schemas/3.0.0-rc.3/enums/preview-output-format.json",
          "default": "url",
          "description": "Output format for the preview. 'url' returns preview_url (iframe-embeddable URL), 'html' returns preview_html (raw HTML for direct embedding)."
        },
        "context": {
          "$ref": "/schemas/3.0.0-rc.3/core/context.json"
        },
        "ext": {
          "$ref": "/schemas/3.0.0-rc.3/core/ext.json"
        }
      },
      "required": [
        "request_type",
        "variant_id"
      ],
      "additionalProperties": true
    }
  ]
}
