{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/connections-icu/json-schema/connections-icu-workspace-bundle-write-input-schema.json",
  "title": "WorkspaceBundleWriteInput",
  "description": "Bundle write input. POST requires name. Bundle resources can reference forms and hosted events, while registration fields, flow edges, and ticket tiers use the same builder JSON model as the workspace UI.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/connections-icu-product-openapi.yml#/components/schemas/WorkspaceBundleWriteInput",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "Public bundle slug."
    },
    "description": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "live",
        "archived"
      ]
    },
    "resources_json": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Resource key, for example form:<id> or event:<id>."
          },
          "type": {
            "type": "string",
            "enum": [
              "form",
              "event"
            ]
          },
          "unlockConditionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "registration_fields_enabled": {
      "type": "boolean"
    },
    "registration_advanced_mode": {
      "type": "boolean"
    },
    "registration_fields": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Registration question. Provide a UUID id when another field or route references it; omit id to let Connections generate one.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "field_key": {
            "type": "string",
            "description": "Stable key for answers, for example linkedin or accredited."
          },
          "field_type": {
            "type": "string",
            "description": "Question type such as text, textarea, email, url, yes_no, select, radio, vote, multi_select, checkbox, or link. yes_no/radio are saved as the same choice-field shape the workspace registration builder uses."
          },
          "label": {
            "type": "string"
          },
          "helper_text": {
            "type": "string"
          },
          "placeholder": {
            "type": "string"
          },
          "is_required": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object"
                }
              ]
            },
            "description": "Choice options for yes_no/select/radio/vote/multi_select fields. Strings are saved directly; objects use value, then label, then id. For yes/no branching, use the canonical strings Yes and No."
          },
          "visibility_field_key": {
            "type": "string",
            "description": "Show this field only after another field has one of visibility_values."
          },
          "visibility_values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ticket_tier_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Product/ticket UUIDs this field routes to or unlocks."
          },
          "ticket_tier_routing_rules": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Advanced per-answer routing rules."
          },
          "sort_order": {
            "type": "integer"
          }
        }
      }
    },
    "registration_flow_edges": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Advanced registration route edge. Use sourceType start/question/ticket and targetType field/tier/end. Legacy sourceId/targetId plus condition.value is accepted, but the full shape matches the workspace builder exactly.",
        "properties": {
          "sourceType": {
            "type": "string",
            "enum": [
              "start",
              "question",
              "ticket"
            ]
          },
          "sourceId": {
            "type": "string"
          },
          "sourceAnswerValue": {
            "type": [
              "string",
              "null"
            ],
            "description": "Answer option for question edges, for example Yes or No. Omit/null for start and ticket edges."
          },
          "targetType": {
            "type": "string",
            "enum": [
              "field",
              "tier",
              "end"
            ]
          },
          "targetId": {
            "type": "string"
          },
          "condition": {
            "type": "object",
            "description": "Legacy shorthand. condition.value is converted into sourceAnswerValue.",
            "deprecated": true
          }
        }
      }
    },
    "ticketing_enabled": {
      "type": "boolean"
    },
    "ticket_tiers": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Free or paid product/ticket. Provide a globally unique UUID id when routing references it; omit id to let Connections generate one. Do not reuse sample UUIDs across events.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "price_cents": {
            "type": "integer",
            "description": "0 for free products."
          },
          "currency": {
            "type": "string",
            "default": "USD"
          },
          "quantity_total": {
            "type": [
              "integer",
              "null"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "hidden",
              "internal"
            ],
            "default": "public"
          },
          "sort_order": {
            "type": "integer"
          },
          "stripe_mode": {
            "type": "string",
            "enum": [
              "platform",
              "imported"
            ],
            "description": "platform = Connections-created product. imported = product/price from the host connected Stripe account."
          },
          "stripe_product_id": {
            "type": "string",
            "description": "Use for imported Stripe products."
          },
          "stripe_price_id": {
            "type": "string",
            "description": "Use for imported Stripe prices."
          },
          "ticket_billing_kind": {
            "type": "string",
            "enum": [
              "one_time",
              "subscription"
            ]
          },
          "billing_interval": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month",
              "year",
              "lifetime"
            ],
            "description": "Use product.defaultPrice.interval from GET /v1/products for imported recurring Stripe prices. Use lifetime for one-time products."
          },
          "billing_interval_count": {
            "type": "integer",
            "default": 1,
            "description": "Use product.defaultPrice.intervalCount from GET /v1/products for imported recurring Stripe prices, for example 4 with billing_interval week."
          },
          "metadata": {
            "type": "object"
          }
        }
      }
    },
    "success_message": {
      "type": "string"
    }
  }
}