{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/ships-delivery-order-schema.json",
  "title": "Ship's Delivery Order",
  "description": "A document issued by or on behalf of a carrier authorising the release of specified cargo to a named party, derived from and referencing the original bill of lading.",
  "type": "object",
  "required": [
    "@context",
    "type",
    "issuer",
    "credentialSubject",
    "credentialSchema"
  ],
  "properties": {
    "@context": {
      "type": "array",
      "description": "JSON-LD contexts: the W3C Verifiable Credentials v2 context, followed by this document's context.",
      "const": [
        "https://www.w3.org/ns/credentials/v2",
        "https://unvtd.unece.org/ships-delivery-order-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "ShipsDeliveryOrderCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Ship's Delivery Order"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/ships-delivery-order-schema.json",
          "description": "Public location of the schema"
        },
        "type": {
          "type": "string",
          "const": "JsonSchema",
          "description": "Schema type identifier"
        }
      },
      "required": [
        "id",
        "type"
      ]
    },
    "id": {
      "type": "string",
      "format": "uri",
      "description": "Unique identifier for the credential",
      "example": "urn:uuid:sdo-2025-au-001234"
    },
    "validFrom": {
      "example": "2025-03-14T00:00:00.000Z",
      "type": "string",
      "format": "date-time",
      "description": "Credential validity start date"
    },
    "validUntil": {
      "example": "2025-04-14T00:00:00.000Z",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "description": "Identifier of the carrier or agent issuing the delivery order (e.g., DID)",
      "type": "string",
      "format": "uri",
      "example": "did:web:pacificshipping.example.com"
    },
    "credentialSubject": {
      "name": "ShipsDeliveryOrder",
      "description": "Ship's delivery order details",
      "type": "object",
      "required": [
        "type",
        "billOfLadingNumber",
        "carrier",
        "consignee",
        "originalLoadingLocation",
        "baseportUnloadingLocation",
        "deliveryLocation",
        "grossWeight",
        "shippingMarks",
        "conveyanceReferenceNumber",
        "transportMeansIdentifier",
        "transportEquipmentIdentifier",
        "sealIdentifier"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "ShipsDeliveryOrder"
        },
        "billOfLadingNumber": {
          "example": "POSL-2025-001234",
          "type": "string",
          "description": "Reference number of the original bill of lading from which this delivery order is derived."
        },
        "consignee": {
          "description": "Party authorised to receive delivery of the cargo.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:waveridersupplies.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Wave Rider Supplies, Inc",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "210 Ocean Road",
                  "type": "string",
                  "description": "The street component of the address."
                },
                "addressLocality": {
                  "example": "Williamsburg",
                  "type": "string",
                  "description": "The city component of the address."
                },
                "addressRegion": {
                  "example": "VA",
                  "type": "string",
                  "description": "The state component of the address."
                },
                "postalCode": {
                  "example": "23185",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "US",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "carrier": {
          "description": "Carrier who issued the original bill of lading and is releasing the goods.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:pacificshipping.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Pacific Ocean Shipping Lines",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "despatchPickupParty": {
          "description": "Party responsible for despatching or picking up the cargo at the port.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:waveridersupplies.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Wave Rider Supplies, Inc",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "addressCountry": {
                  "example": "US",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "originalLoadingLocation": {
          "description": "Port at which the cargo was originally loaded onto the vessel.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Port of Gold Coast",
              "type": "string",
              "description": "Location name."
            },
            "addressLocality": {
              "example": "Gold Coast",
              "type": "string",
              "description": "City."
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country."
            },
            "unLocode": {
              "example": "https://service.unece.org/trade/locode/au.htm#AUGOL",
              "type": "string",
              "format": "uri",
              "description": "UN/LOCODE identifier."
            }
          }
        },
        "baseportUnloadingLocation": {
          "description": "Port at which the cargo is discharged from the vessel.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Port of Los Angeles",
              "type": "string",
              "description": "Location name."
            },
            "addressLocality": {
              "example": "Los Angeles",
              "type": "string",
              "description": "City."
            },
            "addressCountry": {
              "example": "US",
              "type": "string",
              "description": "Country."
            },
            "unLocode": {
              "example": "https://service.unece.org/trade/locode/us.htm#USLAX",
              "type": "string",
              "format": "uri",
              "description": "UN/LOCODE identifier."
            }
          }
        },
        "deliveryLocation": {
          "description": "Location where the cargo is to be delivered to the consignee.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Wave Rider Supplies Warehouse",
              "type": "string",
              "description": "Location name."
            },
            "streetAddress": {
              "example": "210 Ocean Road",
              "type": "string",
              "description": "Street address."
            },
            "addressLocality": {
              "example": "Williamsburg",
              "type": "string",
              "description": "City."
            },
            "addressRegion": {
              "example": "VA",
              "type": "string",
              "description": "State."
            },
            "addressCountry": {
              "example": "US",
              "type": "string",
              "description": "Country."
            }
          }
        },
        "actualArrivalDate": {
          "example": "2025-03-14T07:30:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Actual date and time the vessel arrived at the unloading port."
        },
        "grossWeight": {
          "description": "Total gross weight of the cargo to be released.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Quantity",
              "enum": [
                "Quantity"
              ]
            },
            "amount": {
              "example": 520,
              "type": "number",
              "format": "float",
              "description": "Weight amount."
            },
            "unit": {
              "example": "KGS",
              "type": "string",
              "description": "Weight unit."
            }
          }
        },
        "shippingMarks": {
          "example": "SURFPRO/WRS/001-018",
          "type": "string",
          "description": "Marks and numbers on the packages identifying the cargo to be released."
        },
        "conveyanceReferenceNumber": {
          "example": "VOYAGE-2025-AU-001",
          "type": "string",
          "description": "Voyage number or other journey identifier of the carrying vessel."
        },
        "transportMeansIdentifier": {
          "example": "PACIFIC VOYAGER",
          "type": "string",
          "description": "Name of the vessel carrying the cargo."
        },
        "vehicleRegistrationNumber": {
          "example": "IMO9876543",
          "type": "string",
          "description": "IMO number or other registration identifier of the vessel."
        },
        "transportEquipmentIdentifier": {
          "example": "POSU1234567",
          "type": "string",
          "description": "Identifier of the container or other transport equipment."
        },
        "sealIdentifier": {
          "example": "SEAL123456",
          "type": "string",
          "description": "Identifier of the seal affixed to the transport equipment."
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
