{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/customs-bond-schema.json",
  "title": "Customs Bond",
  "description": "A financial guarantee issued by a surety company on behalf of an importer, assuring customs authorities that applicable duties, taxes, and fees will be paid and applicable regulations will be complied with.",
  "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/customs-bond-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "CustomsBondCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Customs Bond"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/customs-bond-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:cb-2025-us-001234"
    },
    "validFrom": {
      "example": "2025-03-14T00:00:00.000Z",
      "type": "string",
      "format": "date-time",
      "description": "Credential validity start date"
    },
    "validUntil": {
      "example": "2026-03-14T00:00:00.000Z",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "description": "Identifier of the surety company issuing the customs bond (e.g., DID)",
      "type": "string",
      "format": "uri",
      "example": "did:web:globaltradesuretycorp.example.com"
    },
    "credentialSubject": {
      "name": "CustomsBond",
      "description": "Customs bond details",
      "type": "object",
      "required": [
        "type",
        "importer",
        "insuranceCompany",
        "deliveryLocation",
        "despatchLocation",
        "exportationCountry",
        "customsValue",
        "statisticalValue"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "CustomsBond"
        },
        "importer": {
          "description": "Party importing the goods and principal obligor under the customs bond.",
          "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."
                }
              }
            }
          }
        },
        "insuranceCompany": {
          "description": "Surety company guaranteeing the importer's obligations to customs authorities.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:globaltradesuretycorp.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Global Trade Surety Corp",
              "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": "100 Financial Plaza",
                  "type": "string",
                  "description": "The street component of the address."
                },
                "addressLocality": {
                  "example": "New York",
                  "type": "string",
                  "description": "The city component of the address."
                },
                "addressRegion": {
                  "example": "NY",
                  "type": "string",
                  "description": "The state component of the address."
                },
                "postalCode": {
                  "example": "10004",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "US",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "deliveryLocation": {
          "description": "Port of entry or customs office where the goods arrive and the bond is applied.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Port of Los Angeles",
              "type": "string",
              "description": "Location name."
            },
            "addressLocality": {
              "example": "Los Angeles",
              "type": "string",
              "description": "City."
            },
            "addressRegion": {
              "example": "CA",
              "type": "string",
              "description": "State."
            },
            "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."
            }
          }
        },
        "despatchLocation": {
          "description": "Country or place from which the goods are despatched for export.",
          "type": "object",
          "properties": {
            "addressLocality": {
              "example": "Gold Coast",
              "type": "string",
              "description": "City."
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country."
            }
          }
        },
        "exportationCountry": {
          "example": "AU",
          "type": "string",
          "description": "Country from which the goods are exported."
        },
        "customsValue": {
          "description": "Declared value of the goods for customs duty assessment purposes.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "MonetaryAmount",
              "enum": [
                "MonetaryAmount"
              ]
            },
            "amount": {
              "example": 45000,
              "type": "number",
              "format": "float",
              "description": "Monetary amount."
            },
            "currency": {
              "example": "USD",
              "type": "string",
              "minLength": 3,
              "maxLength": 3,
              "description": "ISO 4217 three-letter currency code."
            }
          }
        },
        "statisticalValue": {
          "description": "Value of the goods for trade statistics reporting purposes.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "MonetaryAmount",
              "enum": [
                "MonetaryAmount"
              ]
            },
            "amount": {
              "example": 45000,
              "type": "number",
              "format": "float",
              "description": "Monetary amount."
            },
            "currency": {
              "example": "USD",
              "type": "string",
              "minLength": 3,
              "maxLength": 3,
              "description": "ISO 4217 three-letter currency code."
            }
          }
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
