{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/quotation-schema.json",
  "title": "Quotation",
  "description": "A quotation is a commercial document issued by a seller to a (potential) buyer, offering products or services at stated prices and conditions, valid until a stated expiry date. It may answer a request for quote.",
  "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/quotation-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "QuotationCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Quotation"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/quotation-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 this quotation credential",
      "example": "urn:uuid:quo-2025-ns-0112"
    },
    "validFrom": {
      "example": "2025-01-28T09:00:00Z",
      "type": "string",
      "format": "date-time",
      "description": "Date from which this credential is valid"
    },
    "validUntil": {
      "example": "2026-01-28T09:00:00Z",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "name": "Issuer",
      "description": "Identifier of the party that issued this quotation credential (e.g., DID). Must match the seller.",
      "type": "string",
      "format": "uri",
      "example": "did:web:nordicswell.example.com"
    },
    "credentialSubject": {
      "name": "Quotation",
      "description": "Quotation document details",
      "type": "object",
      "required": [
        "type",
        "quotationNumber",
        "issueDate",
        "expiryDate",
        "seller",
        "buyer",
        "quotedItems"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "Quotation"
        },
        "quotationNumber": {
          "example": "QUO-2025-NS-0112",
          "type": "string",
          "description": "Identifier assigned by the seller to a quotation."
        },
        "requestForQuoteNumber": {
          "example": "RFQ-2025-WRS-007",
          "type": "string",
          "description": "Identifier of the request for quote this quotation answers, if any."
        },
        "issueDate": {
          "example": "2025-01-28T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date of issue of the quotation."
        },
        "expiryDate": {
          "example": "2025-02-27T23:59:59Z",
          "type": "string",
          "format": "date-time",
          "description": "Date until which the quotation can be accepted. Distinct from the validTo of the credential itself."
        },
        "deliveryDate": {
          "example": "2025-03-28T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Offered date of delivery of the goods."
        },
        "seller": {
          "description": "Party offering the merchandise or services.",
          "type": "object",
          "required": [
            "type",
            "id",
            "name"
          ],
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:nordicswell.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Nordic Swell ApS",
              "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": "Ørhagevej 12",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Klitmøller",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "Nordjylland",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "7700",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "DK",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "buyer": {
          "description": "Party to which the quotation is addressed.",
          "type": "object",
          "required": [
            "type",
            "id",
            "name"
          ],
          "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 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": "18 Harbord Road",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Brookvale",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2100",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "deliveryLocation": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Location",
              "enum": [
                "Location"
              ]
            },
            "name": {
              "example": "Sydney Secure Warehousing - Facility A",
              "type": "string",
              "description": "Location name."
            },
            "unLocode": {
              "type": "string",
              "description": "UN/LOCODE location identifier (5 characters)."
            },
            "postalAddress": {
              "description": "The postal address of the location.",
              "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": "Banksmeadow",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2019",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          },
          "description": "Location to which the goods are to be delivered."
        },
        "tradeTermsConditionsCode": {
          "example": "CIF",
          "type": "string",
          "description": "The trade terms (Incoterms) code."
        },
        "tradeTermsConditionsDescription": {
          "example": "CIF Port Botany, Sydney (Incoterms® 2020)",
          "type": "string",
          "description": "Trade terms description, including the named place."
        },
        "paymentTerms": {
          "example": "Documentary credit, payable 30 days after bill of lading date",
          "type": "string",
          "description": "Identification of the terms of payment between the parties to a transaction."
        },
        "paymentMethod": {
          "example": "Documentary credit",
          "type": "string",
          "description": "Code specifying a method of payment."
        },
        "allowanceCharge": {
          "description": "Code specifying a type of an adjustment to a monetary amount such as an allowance or charge.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "allowance",
                "charge"
              ],
              "description": "Whether this is an allowance or charge"
            },
            "description": {
              "type": "string",
              "description": "Description of the allowance or charge"
            },
            "amount": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "MonetaryAmount",
                  "enum": [
                    "MonetaryAmount"
                  ]
                },
                "amount": {
                  "type": "number",
                  "format": "float",
                  "description": "The monetary amount"
                },
                "currency": {
                  "type": "string",
                  "description": "Currency code"
                }
              }
            }
          }
        },
        "totalQuotedAmount": {
          "description": "Total amount of the quotation.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "MonetaryAmount",
              "enum": [
                "MonetaryAmount"
              ]
            },
            "amount": {
              "example": 73250,
              "type": "number",
              "format": "float",
              "description": "Total quoted amount"
            },
            "currency": {
              "example": "USD",
              "type": "string",
              "description": "Currency code"
            }
          }
        },
        "quotedItems": {
          "name": "Quoted Items",
          "description": "Items being quoted",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "productIdentifier",
              "quantityQuoted",
              "unitPrice"
            ],
            "properties": {
              "type": {
                "type": "string",
                "default": "TradeLineItem",
                "enum": [
                  "TradeLineItem"
                ]
              },
              "productIdentifier": {
                "example": "SURF-LB-001",
                "type": "string",
                "description": "Reference number identifying a product."
              },
              "product": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "Product",
                    "enum": [
                      "Product"
                    ]
                  },
                  "id": {
                    "example": "urn:uuid:surf-001-longboard",
                    "type": "string",
                    "format": "uri",
                    "description": "A unique identifier for the product."
                  },
                  "name": {
                    "example": "Professional Longboard - Ocean Series",
                    "type": "string",
                    "description": "Product name"
                  },
                  "description": {
                    "example": "High-performance longboard with premium bamboo core and fiberglass construction, 9'6\" length",
                    "type": "string",
                    "description": "Product description"
                  }
                },
                "description": "Product details"
              },
              "hsCode": {
                "example": "950629",
                "type": "string",
                "description": "Harmonized System (HS) commodity code of the product."
              },
              "originCountry": {
                "example": "VN",
                "type": "string",
                "description": "Country of origin of the product."
              },
              "quantityQuoted": {
                "example": 25,
                "type": "number",
                "description": "The quantity for which the price is quoted."
              },
              "unitPrice": {
                "description": "Price per unit of quantity on which an article item amount is calculated.",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "MonetaryAmount",
                    "enum": [
                      "MonetaryAmount"
                    ]
                  },
                  "amount": {
                    "example": 750,
                    "type": "number",
                    "format": "float",
                    "description": "Unit price amount"
                  },
                  "currency": {
                    "example": "USD",
                    "type": "string",
                    "description": "Currency code"
                  }
                }
              },
              "lineTotal": {
                "description": "Total amount for this line item.",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "MonetaryAmount",
                    "enum": [
                      "MonetaryAmount"
                    ]
                  },
                  "amount": {
                    "example": 18750,
                    "type": "number",
                    "format": "float",
                    "description": "Line total amount"
                  },
                  "currency": {
                    "example": "USD",
                    "type": "string",
                    "description": "Currency code"
                  }
                }
              }
            },
            "description": "A line item in the quotation specifying products or services offered."
          }
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
