{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://citevella.com/tablecheck/schema.json",
  "title": "TableCheck structured quote input 1.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "rows",
    "declared_total",
    "currency"
  ],
  "properties": {
    "rows": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "quantity",
          "unit_price",
          "line_total"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "\\S"
          },
          "quantity": {
            "type": "string",
            "pattern": "^\\d{1,6}$"
          },
          "unit_price": {
            "$ref": "#/$defs/amount"
          },
          "line_total": {
            "$ref": "#/$defs/amount"
          }
        }
      }
    },
    "declared_total": {
      "$ref": "#/$defs/amount"
    },
    "currency": {
      "enum": [
        "USD",
        "EUR",
        "GBP"
      ]
    }
  },
  "$defs": {
    "amount": {
      "type": "string",
      "pattern": "^\\d{1,9}(?:\\.\\d{1,2})?$"
    }
  }
}
