{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://sublimepdf.com/samples/invoice/data.schema.json",
  "title": "Invoice template data (v1)",
  "type": "object",
  "required": ["seller", "customer", "invoice", "items", "totals", "payment"],
  "additionalProperties": false,
  "properties": {
    "seller": {
      "type": "object",
      "required": ["name", "address", "email"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 200 },
        "address": { "type": "array", "items": { "type": "string" }, "maxItems": 6 },
        "email": { "type": "string" },
        "taxId": { "type": "string" }
      }
    },
    "customer": {
      "type": "object",
      "required": ["name", "address"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 200 },
        "address": { "type": "array", "items": { "type": "string" }, "maxItems": 6 }
      }
    },
    "invoice": {
      "type": "object",
      "required": ["number", "issueDate", "dueDate", "currency"],
      "additionalProperties": false,
      "properties": {
        "number": { "type": "string", "minLength": 1 },
        "issueDate": { "type": "string", "description": "Already formatted for display, e.g. 22 Nov 2026" },
        "dueDate": { "type": "string" },
        "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
        "purchaseOrder": { "type": "string" },
        "status": { "type": "string" }
      }
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "maxItems": 500,
      "items": {
        "type": "object",
        "required": ["description", "quantity", "unitPrice", "amount"],
        "additionalProperties": false,
        "properties": {
          "description": { "type": "string", "minLength": 1 },
          "detail": { "type": "string" },
          "quantity": { "type": "string" },
          "unitPrice": { "type": "string" },
          "amount": { "type": "string" }
        }
      }
    },
    "totals": {
      "type": "object",
      "required": ["subtotal", "taxes", "total"],
      "additionalProperties": false,
      "properties": {
        "subtotal": { "type": "string" },
        "taxes": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["label", "amount"],
            "additionalProperties": false,
            "properties": { "label": { "type": "string" }, "amount": { "type": "string" } }
          }
        },
        "total": { "type": "string" }
      }
    },
    "payment": {
      "type": "object",
      "required": ["instructions"],
      "additionalProperties": false,
      "properties": { "instructions": { "type": "string" } }
    },
    "notes": { "type": "string" }
  }
}
