{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usertold-ai/json-schema/usertold-ai-api-study-placement-preview-response-schema.json",
  "title": "ApiStudyPlacementPreviewResponse",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usertold-ai-openapi.json#/components/schemas/ApiStudyPlacementPreviewResponse",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "outcome": {
          "type": "string",
          "enum": [
            "match"
          ]
        },
        "study_ref": {
          "type": "string"
        },
        "study_title": {
          "type": "string"
        },
        "invitation": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "launcher": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "icon": {
                  "type": "string",
                  "enum": [
                    "feedback",
                    "mic",
                    "diagram",
                    "bug",
                    "research"
                  ]
                },
                "style": {
                  "type": "string",
                  "enum": [
                    "calm",
                    "lattice",
                    "beam",
                    "ticket"
                  ]
                },
                "shape": {
                  "type": "string",
                  "enum": [
                    "capsule",
                    "rounded",
                    "square"
                  ]
                }
              },
              "required": [
                "label",
                "icon"
              ],
              "additionalProperties": false
            },
            "panel": {
              "type": "object",
              "properties": {
                "eyebrow": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "headline": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "body": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 600
                },
                "duration_minutes": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 240
                },
                "reward": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "gift",
                        "product",
                        "community",
                        "access"
                      ]
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    },
                    "eligibility": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 240
                    },
                    "delivery": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 240
                    }
                  },
                  "required": [
                    "kind",
                    "label"
                  ],
                  "additionalProperties": false
                },
                "cta": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "image": {
                  "type": "object",
                  "properties": {
                    "asset_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2000,
                      "format": "uri"
                    },
                    "alt": {
                      "type": "string",
                      "maxLength": 160
                    }
                  },
                  "required": [
                    "asset_id",
                    "url",
                    "alt"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "headline",
                "cta"
              ],
              "additionalProperties": false
            },
            "presentation_mode": {
              "type": "string",
              "enum": [
                "passive",
                "contextual",
                "direct_link"
              ]
            },
            "brand_color": {
              "type": "object",
              "properties": {
                "light": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "dark": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": [
                "light"
              ],
              "additionalProperties": false
            },
            "foreground_color": {
              "type": "string",
              "pattern": "^#[0-9a-fA-F]{6}$"
            },
            "placement": {
              "type": "object",
              "properties": {
                "desktop": {
                  "type": "string",
                  "enum": [
                    "bottom-left",
                    "bottom-right"
                  ]
                },
                "mobile": {
                  "type": "string",
                  "enum": [
                    "bottom-left",
                    "bottom-right"
                  ]
                }
              },
              "required": [
                "desktop",
                "mobile"
              ],
              "additionalProperties": false
            },
            "participant_interview_link": {
              "type": "boolean"
            }
          },
          "required": [
            "launcher",
            "presentation_mode",
            "brand_color",
            "placement"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "outcome",
        "study_ref",
        "study_title",
        "invitation"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "outcome": {
          "type": "string",
          "enum": [
            "no_match"
          ]
        }
      },
      "required": [
        "outcome"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "outcome": {
          "type": "string",
          "enum": [
            "ambiguous"
          ]
        },
        "reason": {
          "type": "string",
          "enum": [
            "configuration_ambiguous"
          ]
        },
        "ambiguous_study_refs": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 2,
          "maxItems": 100
        }
      },
      "required": [
        "outcome",
        "reason",
        "ambiguous_study_refs"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "outcome": {
          "type": "string",
          "enum": [
            "unavailable"
          ]
        },
        "study_ref": {
          "type": "string"
        },
        "reason": {
          "type": "string",
          "enum": [
            "inactive",
            "capacity_reached",
            "configuration_invalid",
            "runtime_unavailable"
          ]
        }
      },
      "required": [
        "outcome",
        "study_ref",
        "reason"
      ],
      "additionalProperties": false
    }
  ]
}