{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://abcs.sirvisetti.com/schemas/objects/logistics/shipment.schema.json",
  "title": "ABCS Shipment",
  "type": "object",
  "additionalProperties": false,
  "required": ["number", "shipper", "consignee", "status"],
  "properties": {
    "number": {"type": "string", "minLength": 1},
    "shipper": {"$ref": "../../common/party-reference.schema.json"},
    "consignee": {"$ref": "../../common/party-reference.schema.json"},
    "carrier": {"$ref": "../../common/party-reference.schema.json"},
    "origin": {"$ref": "../../common/address.schema.json"},
    "destination": {"$ref": "../../common/address.schema.json"},
    "plannedDispatchDate": {"type": "string", "format": "date"},
    "actualDispatchAt": {"type": "string", "format": "date-time"},
    "plannedDeliveryDate": {"type": "string", "format": "date"},
    "actualDeliveryAt": {"type": "string", "format": "date-time"},
    "references": {"type": "array", "items": {"$ref": "../../common/business-object-reference.schema.json"}},
    "status": {
      "type": "object",
      "additionalProperties": false,
      "required": ["lifecycle"],
      "properties": {
        "lifecycle": {"type": "string", "enum": ["planned", "ready", "dispatched", "in-transit", "delivered", "cancelled"]}
      }
    }
  }
}
