{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/certifyos/main/json-schema/certifyos-create-multi-tenant-form-submission-request-schema.json",
  "title": "CreateMultiTenantFormSubmissionRequest",
  "description": "Request payload for creating a multi-tenant form submission",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/certifyos-form-submissions-api-openapi.yml#/components/schemas/CreateMultiTenantFormSubmissionRequest",
  "type": "object",
  "required": [
    "data",
    "tenantIds"
  ],
  "properties": {
    "data": {
      "description": "A flexible object for storing any data related to a form submission. May contain practitionerData or facilityData (but not both) as nested objects, plus submissionPdfUrl, supportingDocuments, and any other form fields."
    },
    "tenantIds": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      },
      "description": "List of tenant IDs to fan out to. Must contain at least one entry."
    },
    "options": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/TenantOptions"
      },
      "description": "Per-tenant options controlling crosswalk creation. Keys are tenant IDs. Tenants absent from this map default to createPractitioner=false and createFacility=false."
    }
  },
  "$defs": {
    "TenantOptions": {
      "type": "object",
      "description": "Per-tenant options for multi-tenant form submission fan-out",
      "properties": {
        "createPractitioner": {
          "type": "boolean",
          "description": "When true, creates a tenant practitioner crosswalk in addition to the portal crosswalk. Requires practitionerData to be present in the request.",
          "default": false
        },
        "createFacility": {
          "type": "boolean",
          "description": "When true, creates a tenant facility crosswalk in addition to the portal crosswalk. Requires facilityData to be present in the request.",
          "default": false
        }
      }
    }
  }
}