{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://download.opter.com/json/opterEventJsonSchema1.0.json",
  "title": "Opter TextEDI - event and response message",
  "$comment": "Generated from OpterTextEdi.yaml 1.3.2. Do not edit by hand. Identical to opterEventResponseSchema1.0.json.",
  "type": "array",
  "description": "Every message sent as a JSON array — in either direction — validates\nagainst this one schema: transport events (`status`, `packagescan`,\n`freightbillscan`, `pod`, `revoke`, `deviation`, `priceitem`,\n`attachment`) and Opter's answer to an order booking (`response`).\nThe array always holds exactly one element: an event object, or —\nfor the four legacy booking failures — a plain error string.\n\nPublished as both `opterEventJsonSchema1.0.json` and\n`opterEventResponseSchema1.0.json`; the two files are identical.\n",
  "minItems": 1,
  "maxItems": 1,
  "items": {
    "oneOf": [
      {
        "type": "object",
        "description": "A single event message. Contains the shared envelope fields plus\nexactly one payload key from: `status`, `packagescan`,\n`freightbillscan`, `pod`, `revoke`, `deviation`, `priceitem`,\n`attachment`, or `response`. The payload key and its\n`eventMappingCode` together define the specific message type.\n\n`opterOrderReference` is **required** at envelope level on every\nevent message.\n\nExactly one payload key per event and `freightBillNumber` on\n`freightbillscan` are enforced by the JSON Schema\n(`opterEventJsonSchema1.0.json`); OpenAPI 3.0 cannot express them.\n",
        "additionalProperties": false,
        "required": [
          "schema",
          "version",
          "eventCreatedDateTime",
          "opterOrderReference"
        ],
        "properties": {
          "schema": {
            "type": "string",
            "format": "uri",
            "description": "Always `https://download.opter.com/json/opterEventJsonSchema1.0.json`.",
            "examples": [
              "https://download.opter.com/json/opterEventJsonSchema1.0.json"
            ]
          },
          "version": {
            "type": "string",
            "description": "Schema version. Currently `\"1.0\"`.",
            "examples": [
              "1.0"
            ]
          },
          "eventCreatedDateTime": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
            "description": "When this event message was created."
          },
          "eventSender": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "Optional free text. Identifier of the message sender, usually agreed with the\ncounterpart during setup. Not validated — for debugging and tracing only.\n"
          },
          "eventReceiver": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "Optional free text. Identifier of the message receiver, usually agreed with the\ncounterpart during setup. Not validated — for debugging and tracing only.\n"
          },
          "opterOrderReference": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opter internal order number. Required on every event. Use to correlate with your orders."
          },
          "customerOrderReference": {
            "type": "string",
            "maxLength": 100,
            "description": "Your order reference, echoed back for correlation."
          },
          "freightBillNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "Freight bill number associated with this order. Required when `freightbillscan` is the payload key."
          },
          "estimatedTransportCost": {
            "type": [
              "number",
              "null"
            ],
            "description": "Estimated transport cost (if available, usually in local currency)."
          },
          "estimatedTransportCo2Emission": {
            "type": [
              "number",
              "null"
            ],
            "description": "Estimated CO₂ emission in grams (if available)."
          },
          "response": {
            "type": "object",
            "additionalProperties": false,
            "description": "Response details including status, packages, and any generated documents.",
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$"
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "enum": [
                  "imported",
                  "failed",
                  "accepted",
                  "rejected"
                ],
                "description": "Result code:\n- `imported` — order was created/updated successfully\n- `accepted` — order was accepted but processing is not complete\n- `failed` — order could not be processed (see `errors`)\n- `rejected` — order was rejected (see `errors`)\n"
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Human-readable result description."
              },
              "errors": {
                "type": [
                  "array",
                  "null"
                ],
                "description": "Structured errors. Each entry has a numeric `type` code and a\nhuman-readable `description`. Non-empty means the order was NOT\nprocessed successfully. (Note: the four legacy validation\nfailures listed in §5.2 of the Integration Guide are returned\nas plain strings in the top-level response array instead of\ninside this structured `errors` array.)\n",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "type": {
                      "type": "integer",
                      "description": "Error type code."
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Error description."
                    }
                  }
                }
              },
              "warnings": {
                "type": [
                  "array",
                  "null"
                ],
                "description": "Structured warnings. Order processed but with caveats.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "type": {
                      "type": "integer",
                      "description": "Warning type code."
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 100,
                      "description": "Warning description."
                    }
                  }
                }
              },
              "packages": {
                "type": "array",
                "description": "Packages with Opter-assigned IDs. Store `opterId` for tracking.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Package reference as included in event payloads.",
                  "properties": {
                    "opterId": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Opter internal package ID."
                    },
                    "customerReference": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Your package reference."
                    },
                    "barcode": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Package barcode."
                    }
                  }
                }
              },
              "freightBillBase64encoded": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Base64-encoded freight bill PDF (empty/null if not generated)."
              },
              "packageLabelBase64encoded": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Base64-encoded package label PDF (empty/null if not generated)."
              }
            }
          },
          "status": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "description": "Order-level status event. Used for transport stage transitions\n(departure, arrival, terminal handling). Contains all packages in\nthe order. When `eventMappingCode == \"arrival\"`, this event may\nalso carry POD (proof-of-delivery) fields.\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the status event actually occurred (may differ from `eventCreatedDateTime`)."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "enum": [
                  "departure",
                  "arrival",
                  "departureTerminal",
                  "arrivalTerminal",
                  "departureDistributionTerminal",
                  "arrivalDistributionTerminal"
                ],
                "description": "- `departure` — Vehicle has departed from the pickup location.\n- `arrival` — Vehicle has arrived at the delivery location. May carry POD fields.\n- `departureTerminal` / `arrivalTerminal` — Vehicle handling at origin/destination terminal.\n- `departureDistributionTerminal` / `arrivalDistributionTerminal` — Vehicle handling at distribution terminal.\n"
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Human-readable description of the event."
              },
              "eventLocation": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Location of the event. For terminal codes, mapped to a hubCode\nin Opter (must be pre-agreed); otherwise free-text city name.\n"
              },
              "eventLatitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -90,
                "maximum": 90,
                "description": "GPS latitude of the event location."
              },
              "eventLongitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -180,
                "maximum": 180,
                "description": "GPS longitude of the event location."
              },
              "transporterResource": {
                "type": "string",
                "maxLength": 50,
                "description": "Identifier of the vehicle or driver resource (may be empty)."
              },
              "packages": {
                "type": "array",
                "description": "All packages associated with this order.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Package reference as included in event payloads.",
                  "properties": {
                    "opterId": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Opter internal package ID."
                    },
                    "customerReference": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Your package reference."
                    },
                    "barcode": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Package barcode."
                    }
                  }
                }
              },
              "podSigneeName": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Printed name on POD. Only valid when `eventMappingCode == \"arrival\"`."
              },
              "podComment": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Comment on POD. Only valid when `eventMappingCode == \"arrival\"`."
              },
              "podSignatureUrl": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string",
                  "maxLength": 255
                },
                "description": "URLs to POD images — one or more (signature, photos). Max 255 chars each. Only valid when `eventMappingCode == \"arrival\"`."
              },
              "podSignatureImageBase64encoded": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "Base64-encoded POD images — one or more. The drawn signature comes first when there is one, followed by delivery photos. Only valid when `eventMappingCode == \"arrival\"`."
              }
            },
            "if": {
              "properties": {
                "eventMappingCode": {
                  "const": "arrival"
                }
              },
              "required": [
                "eventMappingCode"
              ]
            },
            "then": true,
            "else": {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "podSigneeName"
                    ]
                  },
                  {
                    "required": [
                      "podComment"
                    ]
                  },
                  {
                    "required": [
                      "podSignatureUrl"
                    ]
                  },
                  {
                    "required": [
                      "podSignatureImageBase64encoded"
                    ]
                  }
                ]
              }
            }
          },
          "packagescan": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode",
              "package"
            ],
            "description": "Individual package scan event at a barcode reader. Contains a\n**single** `package` object (not an array). The full enum supports\nall standard scan codes plus their `undo*` counterparts and a\n`floorcheck` code.\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the scan occurred."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "enum": [
                  "departure",
                  "arrival",
                  "departureTerminal",
                  "arrivalTerminal",
                  "departureDistributionTerminal",
                  "arrivalDistributionTerminal",
                  "departureExternalTerminal",
                  "arrivalExternalTerminal",
                  "undoDeparture",
                  "undoArrival",
                  "undoDepartureTerminal",
                  "undoArrivalTerminal",
                  "undoDepartureDistributionTerminal",
                  "undoArrivalDistributionTerminal",
                  "undoDepartureExternalTerminal",
                  "undoArrivalExternalTerminal",
                  "floorcheck",
                  "undoFloorcheck"
                ],
                "description": "Scan event code. The `*Terminal` codes use `eventLocation` as a\nmapped hubCode in Opter (pre-agreed). The `*ExternalTerminal`\ncodes use `eventLocation` as a free-text field for partner-run\nterminals. The `undo*` codes reverse a previous scan.\n"
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Human-readable scan description."
              },
              "eventLocation": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Terminal/location name. For internal terminal scans, mapped to\na hubCode in Opter. For external terminal scans, free text.\n"
              },
              "eventLatitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -90,
                "maximum": 90,
                "description": "GPS latitude."
              },
              "eventLongitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -180,
                "maximum": 180,
                "description": "GPS longitude."
              },
              "package": {
                "description": "The scanned package. `barcode` is mandatory — it identifies the package.",
                "allOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Package reference as included in event payloads.",
                    "properties": {
                      "opterId": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "description": "Opter internal package ID."
                      },
                      "customerReference": {
                        "type": "string",
                        "maxLength": 50,
                        "description": "Your package reference."
                      },
                      "barcode": {
                        "type": "string",
                        "maxLength": 50,
                        "description": "Package barcode."
                      }
                    }
                  },
                  {
                    "required": [
                      "barcode"
                    ]
                  }
                ]
              }
            }
          },
          "freightbillscan": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "description": "Freight-bill barcode scan. Same 18-value code enum as `packagescan`.\nWhen this payload is used, `freightBillNumber` is **required** at\nenvelope level (enforced by the JSON Schema).\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the scan occurred."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "enum": [
                  "departure",
                  "arrival",
                  "departureTerminal",
                  "arrivalTerminal",
                  "departureDistributionTerminal",
                  "arrivalDistributionTerminal",
                  "departureExternalTerminal",
                  "arrivalExternalTerminal",
                  "undoDeparture",
                  "undoArrival",
                  "undoDepartureTerminal",
                  "undoArrivalTerminal",
                  "undoDepartureDistributionTerminal",
                  "undoArrivalDistributionTerminal",
                  "undoDepartureExternalTerminal",
                  "undoArrivalExternalTerminal",
                  "floorcheck",
                  "undoFloorcheck"
                ],
                "description": "Same semantics as `packagescan.eventMappingCode`."
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50
              },
              "eventLocation": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50
              },
              "eventLatitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -90,
                "maximum": 90
              },
              "eventLongitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -180,
                "maximum": 180
              },
              "packages": {
                "type": "array",
                "description": "Packages associated with the freight bill.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Package reference as included in event payloads.",
                  "properties": {
                    "opterId": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Opter internal package ID."
                    },
                    "customerReference": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Your package reference."
                    },
                    "barcode": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Package barcode."
                    }
                  }
                }
              }
            }
          },
          "pod": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "description": "Proof-of-delivery event. Indicates that goods have been delivered\n(fully or partially) to the consignee. May include signature data.\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the delivery occurred."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "description": "Open string. Lower case is translated to upper case on import\ninto Opter. Common values include `arrival` (full delivery),\n`partialdelivery` (some packages not delivered), but other\ncarrier-specific codes are accepted.\n"
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Human-readable delivery description (e.g., \"received by the consignee\")."
              },
              "eventLatitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -90,
                "maximum": 90
              },
              "eventLongitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -180,
                "maximum": 180
              },
              "packages": {
                "type": "array",
                "description": "Packages included in this delivery.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Package reference as included in event payloads.",
                  "properties": {
                    "opterId": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Opter internal package ID."
                    },
                    "customerReference": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Your package reference."
                    },
                    "barcode": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Package barcode."
                    }
                  }
                }
              },
              "podSigneeName": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Name of the person who signed for the delivery (empty/null if not captured)."
              },
              "podComment": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Free-text comment captured at delivery."
              },
              "podSignatureUrl": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string",
                  "maxLength": 255
                },
                "description": "URLs to POD images — one or more. Max 255 chars each. Opter exports at most one URL; the images themselves are in `podSignatureImageBase64encoded`. Empty array or null if none."
              },
              "podSignatureImageBase64encoded": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "Base64-encoded POD images — one or more. The drawn signature comes first when there is one, followed by delivery photos. Empty array or null if none."
              }
            }
          },
          "revoke": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime"
            ],
            "description": "Order revocation event. Indicates that an order has been cancelled/removed.\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the revocation occurred."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "description": "Mapping code for the revocation (commonly `orderRevoked`,\nbut other carrier-specific codes are accepted).\n"
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Reason or description (e.g., \"order was removed\")."
              },
              "packages": {
                "type": "array",
                "description": "Packages that were part of the revoked order.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Package reference as included in event payloads.",
                  "properties": {
                    "opterId": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Opter internal package ID."
                    },
                    "customerReference": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Your package reference."
                    },
                    "barcode": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Package barcode."
                    }
                  }
                }
              }
            }
          },
          "deviation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "description": "Deviation / exception event. Reports a problem encountered during\ntransport (damage, delay, missed delivery, refused delivery, etc.).\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the deviation occurred."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "description": "Open string. Carrier-configured deviation code."
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Human-readable description."
              },
              "eventLatitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -90,
                "maximum": 90
              },
              "eventLongitude": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": -180,
                "maximum": 180
              },
              "packages": {
                "type": "array",
                "description": "Packages affected by the deviation.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "description": "Package reference as included in event payloads.",
                  "properties": {
                    "opterId": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Opter internal package ID."
                    },
                    "customerReference": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Your package reference."
                    },
                    "barcode": {
                      "type": "string",
                      "maxLength": 50,
                      "description": "Package barcode."
                    }
                  }
                }
              },
              "deviationEvent": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Sub-event under `eventMappingCode` (e.g., specific deviation type)."
              },
              "deviationReason": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Sub-event under `deviationEvent` (e.g., specific reason)."
              },
              "deviationComment": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50,
                "description": "Free-text comment."
              },
              "deviationUrl": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string",
                  "maxLength": 255
                },
                "description": "URLs to deviation evidence (images, documents) — one or more. Max 255 chars each."
              },
              "deviationImageBase64encoded": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "Base64-encoded deviation evidence images — one or more. Opter exports deviation images here, not in `deviationUrl`."
              }
            }
          },
          "priceitem": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "description": "Price line item event. Used to communicate pricing details for an\norder, including unit pricing, contractor invoice tracking, and\ncustom IDs. Lower-case `eventMappingCode` is translated to upper\ncase on import into Opter.\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
                "description": "When the price item event was created."
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "description": "Open string. Carrier-configured price item code (lower case is uppercased on import)."
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 1024,
                "description": "Description of the price item."
              },
              "opterId": {
                "type": "integer",
                "description": "Opter internal price item ID."
              },
              "customerReference": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50
              },
              "state": {
                "type": "string",
                "enum": [
                  "new",
                  "update"
                ],
                "description": "Lifecycle state."
              },
              "quantity": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999,
                "description": "Up to 18 digits, 6 decimals."
              },
              "unit1quantity": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "unit1name": {
                "type": "string",
                "maxLength": 50
              },
              "unit2quantity": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "unit2name": {
                "type": "string",
                "maxLength": 50
              },
              "unitPrice": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "unitPriceResource": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "fixedPrice": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "fixedPriceResource": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "resourceCode": {
                "type": "string",
                "maxLength": 50
              },
              "contractorExpectedCost": {
                "type": [
                  "number",
                  "null"
                ],
                "multipleOf": 1e-06,
                "minimum": -9999999999999999,
                "maximum": 9999999999999999
              },
              "contractorInvoiceNo": {
                "type": "string",
                "maxLength": 50
              },
              "contractorInvoiceDate": {
                "type": "string",
                "format": "date"
              },
              "contractorInvoiceDone": {
                "type": "boolean"
              },
              "extraId1": {
                "type": "string",
                "maxLength": 50
              },
              "extraId2": {
                "type": "string",
                "maxLength": 50
              },
              "extraId3": {
                "type": "string",
                "maxLength": 50
              },
              "extraId4": {
                "type": "string",
                "maxLength": 50
              },
              "extraId5": {
                "type": "string",
                "maxLength": 50
              },
              "extraId6": {
                "type": "string",
                "maxLength": 50
              },
              "extraId7": {
                "type": "string",
                "maxLength": 50
              },
              "extraId8": {
                "type": "string",
                "maxLength": 50
              }
            }
          },
          "attachment": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "eventDateTime",
              "eventMappingCode"
            ],
            "description": "Generic file attachment associated with an order (CMR, freight bill,\nAWB, POD, deviation evidence, customs document, EDI, image, package\nlabel, etc.). Provide either `attachmentUrl` or\n`attachmentBase64encoded`.\n",
            "properties": {
              "eventDateTime": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$"
              },
              "eventMappingCode": {
                "type": "string",
                "maxLength": 50,
                "enum": [
                  "cmr",
                  "freightbill",
                  "awb",
                  "pod",
                  "deviation",
                  "image",
                  "customsdocument",
                  "edi",
                  "packagelabel"
                ],
                "description": "Type of attachment."
              },
              "eventDescription": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 255
              },
              "attachmentComment": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 255
              },
              "attachmentFileName": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 50
              },
              "attachmentUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 255,
                "description": "URL to download the attachment."
              },
              "attachmentBase64encoded": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Base64-encoded attachment content."
              }
            }
          }
        },
        "oneOf": [
          {
            "required": [
              "response"
            ]
          },
          {
            "required": [
              "status"
            ]
          },
          {
            "required": [
              "packagescan"
            ]
          },
          {
            "required": [
              "freightbillscan"
            ]
          },
          {
            "required": [
              "pod"
            ]
          },
          {
            "required": [
              "revoke"
            ]
          },
          {
            "required": [
              "deviation"
            ]
          },
          {
            "required": [
              "priceitem"
            ]
          },
          {
            "required": [
              "attachment"
            ]
          }
        ],
        "allOf": [
          {
            "if": {
              "required": [
                "freightbillscan"
              ]
            },
            "then": {
              "required": [
                "freightBillNumber"
              ],
              "properties": {
                "freightBillNumber": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          }
        ]
      },
      {
        "type": "string",
        "description": "Plain-string error returned for the four legacy validation failures.\nReturned as the only element in the top-level response array (not\ninside a structured `errors` array). Possible values:\n- `EXCEPTION_Service type incorrect (and no default)`\n- `EXCEPTION_Vehicle type incorrect (and no default)`\n- `EXCEPTION_Incorrect customer code`\n- `NOT IMPLEMENTED`\n"
      }
    ]
  }
}
