{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/PurchaseOrder",
  "title": "PurchaseOrder",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "descriptor": {
      "type": "string"
    },
    "purchaseOrderNumber": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "submitted",
        "approved",
        "received",
        "closed"
      ]
    },
    "supplier": {
      "$ref": "#/components/schemas/ResourceReference"
    },
    "totalAmount": {
      "type": "number",
      "format": "double"
    },
    "currency": {
      "type": "string"
    },
    "orderDate": {
      "type": "string",
      "format": "date"
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "lineNumber": {
            "type": "integer"
          },
          "item": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitCost": {
            "type": "number"
          },
          "totalCost": {
            "type": "number"
          }
        }
      }
    },
    "href": {
      "type": "string",
      "format": "uri"
    }
  }
}