{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/warehouse-receipt-schema.json",
  "title": "Warehouse Receipt",
  "description": "A document issued by a warehouse operator acknowledging the receipt of goods for storage and establishing the terms under which the goods are held.",
  "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/warehouse-receipt-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "WarehouseReceiptCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Warehouse Receipt"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/warehouse-receipt-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:wr-2025-sydney-001"
    },
    "validFrom": {
      "example": "2025-03-13:10:00",
      "type": "string",
      "format": "date-time",
      "description": "Credential validity start date"
    },
    "validUntil": {
      "example": "2026-03-13:10:00",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "name": "Issuer",
      "description": "Identifier of the party operating the warehouse (e.g., DID)",
      "type": "string",
      "format": "uri",
      "example": "did:web:sydneywarehousing.example.com"
    },
    "credentialSubject": {
      "name": "WarehouseReceipt",
      "description": "Warehouse receipt details",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "WarehouseReceipt"
        },
        "documentIdentifier": {
          "example": "WR-2025-SYD-001234",
          "type": "string",
          "description": "Reference number identifying a specific document."
        },
        "issueDate": {
          "example": "2025-03-13T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date that a document was issued."
        },
        "warehouseDepositor": {
          "description": "Party depositing goods in a warehouse.",
          "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": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "75002",
                  "type": "string",
                  "description": "Postal code"
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "warehouseKeeper": {
          "description": "Party taking responsibility for goods entered into a warehouse.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:sydneywarehousing.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Sydney Secure Warehousing Pty Ltd",
              "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": "45 Logistics Way",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Sydney",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2015",
                  "type": "string",
                  "description": "Postal code"
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "warehouse": {
          "description": "Warehouse where a particular consignment has been stored.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Sydney Secure Warehousing - Facility A",
              "type": "string",
              "description": "Warehouse name"
            },
            "streetAddress": {
              "example": "45 Logistics Way",
              "type": "string",
              "description": "Street address"
            },
            "addressLocality": {
              "example": "Sydney",
              "type": "string",
              "description": "City"
            },
            "addressRegion": {
              "example": "NSW",
              "type": "string",
              "description": "State"
            },
            "postalCode": {
              "example": "2015",
              "type": "string",
              "description": "Postal code"
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country"
            },
            "warehouseCode": {
              "example": "SSW-FAC-A",
              "type": "string",
              "description": "Internal warehouse code"
            }
          }
        },
        "placeOfIssue": {
          "description": "Location where a document was issued.",
          "type": "object",
          "properties": {
            "addressLocality": {
              "example": "Sydney",
              "type": "string",
              "description": "City"
            },
            "addressRegion": {
              "example": "NSW",
              "type": "string",
              "description": "State"
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country"
            }
          }
        },
        "transportContractNumber": {
          "example": "BKG123456789",
          "type": "string",
          "description": "Reference number to identify a document evidencing a transport contract."
        },
        "billOfLadingNumber": {
          "example": "POSL-2025-001234",
          "type": "string",
          "description": "Reference number to identify a bill of lading."
        },
        "invoiceNumber": {
          "example": "INV-2025-031-001",
          "type": "string",
          "description": "Reference number to identify an invoice."
        },
        "actualArrivalDate": {
          "example": "2025-03-13T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date of the arrival of means of transport."
        },
        "actualDepartureDate": {
          "example": "2025-03-12T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date of the departure of means of transport."
        },
        "storageStartDate": {
          "example": "2025-03-13T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date when storage begins."
        },
        "authentication": {
          "example": "This receipt is authenticated and signed by Sydney Secure Warehousing Pty Ltd",
          "type": "string",
          "description": "Proof that a document has been authenticated."
        },
        "documentEndorsement": {
          "example": "Negotiable - To order of depositor",
          "type": "string",
          "description": "Proof that a document has been signed."
        },
        "storageConditions": {
          "example": "Goods stored in climate-controlled facility at ambient temperature",
          "type": "string",
          "description": "Conditions under which goods are stored."
        },
        "handlingInstructions": {
          "example": "Handle with care. Keep dry. This side up.",
          "type": "string",
          "description": "Instructions on how goods should be handled."
        },
        "deliveryInstructions": {
          "example": "Release only upon presentation of original receipt and proper identification",
          "type": "string",
          "description": "Delivery instructions relating to a consignment."
        },
        "totalGrossWeight": {
          "description": "Total gross weight of stored goods.",
          "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"
            }
          }
        },
        "totalVolume": {
          "description": "Total volume of stored goods.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Quantity",
              "enum": [
                "Quantity"
              ]
            },
            "amount": {
              "example": 8.5,
              "type": "number",
              "format": "float",
              "description": "Volume amount"
            },
            "unit": {
              "example": "CBM",
              "type": "string",
              "description": "Volume unit"
            }
          }
        },
        "totalPackages": {
          "example": 18,
          "type": "number",
          "description": "Total number of packages."
        },
        "storedGoods": {
          "name": "Stored Goods",
          "description": "Goods stored in the warehouse",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "description": {
                "example": "Professional Longboard - Ocean Series",
                "type": "string",
                "description": "Plain language description of the goods."
              },
              "quantity": {
                "description": "Number of units",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "Quantity",
                    "enum": [
                      "Quantity"
                    ]
                  },
                  "amount": {
                    "example": 25,
                    "type": "number",
                    "description": "Quantity amount"
                  },
                  "unit": {
                    "example": "Units",
                    "type": "string",
                    "description": "Unit of measure"
                  }
                }
              },
              "numberOfPackages": {
                "example": 5,
                "type": "number",
                "description": "Number of packages."
              },
              "packagingType": {
                "example": "CT",
                "type": "string",
                "description": "Code specifying the type of packaging."
              },
              "shippingMarks": {
                "example": "SURFPRO/WRS/001-005",
                "type": "string",
                "description": "Free form description of the marks and numbers."
              },
              "grossWeight": {
                "description": "Gross weight including packaging.",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "Quantity",
                    "enum": [
                      "Quantity"
                    ]
                  },
                  "amount": {
                    "example": 200,
                    "type": "number",
                    "format": "float",
                    "description": "Weight amount"
                  },
                  "unit": {
                    "example": "KGS",
                    "type": "string",
                    "description": "Weight unit"
                  }
                }
              },
              "storageLocation": {
                "example": "Zone A, Row 12, Bay 3-4",
                "type": "string",
                "description": "Location within the warehouse where goods are stored."
              },
              "condition": {
                "example": "Good condition",
                "type": "string",
                "description": "Condition of the goods upon receipt."
              }
            },
            "description": "A specific goods item stored in the warehouse."
          }
        }
      },
      "required": [
        "type",
        "documentIdentifier",
        "issueDate",
        "warehouseDepositor",
        "warehouseKeeper",
        "warehouse",
        "storedGoods",
        "totalGrossWeight",
        "totalPackages"
      ],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
