{
  "version": 2,
  "assets": {
    "harbor": {
      "mime": "image/png",
      "file": "harbor_logo"
    }
  },
  "template": {
    "style": {
      "font_size": 8.5,
      "padding_mm": 2.2,
      "border_radius_mm": 1.1,
      "border_color": "#C8D5E1"
    },
    "fields": {
      "invoice_number": {
        "type": "string",
        "label": "Invoice No.",
        "required": true
      },
      "issued": {
        "type": "date",
        "label": "Issued",
        "required": true
      },
      "customer": {
        "type": "string",
        "label": "Customer",
        "required": true
      },
      "amount": {
        "type": "number",
        "label": "Total Due",
        "format": "currency",
        "currency": "USD",
        "required": true
      },
      "item": {
        "type": "string",
        "label": "Description",
        "required": true
      },
      "quantity": {
        "type": "integer",
        "label": "Qty",
        "required": true
      },
      "price": {
        "type": "number",
        "label": "Rate (USD)"
      },
      "line_total": {
        "type": "number",
        "label": "Amount (USD)"
      },
      "verification": {
        "type": "qrcode",
        "label": "Verify this invoice"
      },
      "reference_barcode": {
        "type": "barcode",
        "label": "Invoice reference"
      },
      "status": {
        "type": "string",
        "label": "Status"
      },
      "due_date": {
        "type": "date",
        "label": "Payment Due"
      },
      "purchase_order": {
        "type": "string",
        "label": "Purchase Order"
      },
      "project": {
        "type": "string",
        "label": "Project / Cost Centre"
      },
      "subtotal": {
        "type": "number",
        "label": "Subtotal",
        "format": "currency",
        "currency": "USD"
      },
      "tax": {
        "type": "number",
        "label": "VAT (10%)",
        "format": "currency",
        "currency": "USD"
      },
      "payment": {
        "type": "text",
        "label": "Payment Instructions"
      },
      "terms": {
        "type": "text",
        "label": "Terms / Supporting Records"
      }
    },
    "sections": [
      {
        "rows": [
          {
            "type": "header",
            "title": "INVOICE",
            "logos": [
              "harbor"
            ],
            "lines": [
              "Harbor Engineering Services Ltd.",
              "Engineering & project support"
            ],
            "metadata_fields": [
              "invoice_number",
              "status"
            ],
            "repeat": "all"
          },
          {
            "type": "fields",
            "fields": [
              {
                "field": "invoice_number",
                "weight": 1.2
              },
              {
                "field": "issued",
                "weight": 1
              },
              {
                "field": "customer",
                "weight": 1.8
              },
              {
                "field": "amount",
                "weight": 1.5,
                "style": {
                  "size": "large",
                  "align": "right",
                  "background": "#EDF4FA",
                  "border_color": null
                }
              }
            ]
          }
        ]
      },
      {
        "title": "Billing and contract details",
        "title_style": {
          "background": "#193550",
          "foreground": "#FFFFFF",
          "border_color": null,
          "padding_mm": 1.8,
          "border_radius_mm": 0.7,
          "font_size": 9
        },
        "rows": [
          {
            "type": "issued_by_to",
            "from_source": "sender",
            "to_source": "recipient"
          },
          {
            "type": "fields",
            "fields": [
              {
                "field": "purchase_order",
                "weight": 1
              },
              {
                "field": "project",
                "weight": 2
              },
              {
                "field": "due_date",
                "weight": 1
              }
            ],
            "style": {
              "background": "#F2F6FA",
              "border_color": null
            }
          }
        ]
      },
      {
        "title": "Services and charges",
        "title_style": {
          "background": "#193550",
          "foreground": "#FFFFFF",
          "border_color": null,
          "padding_mm": 1.8,
          "border_radius_mm": 0.7,
          "font_size": 9
        },
        "rows": [
          {
            "type": "table",
            "source": "items",
            "columns": [
              {
                "field": "item",
                "weight": 4.6
              },
              {
                "field": "quantity",
                "weight": 0.6,
                "style": {
                  "align": "center"
                }
              },
              {
                "field": "price",
                "weight": 1.3,
                "style": {
                  "align": "right"
                }
              },
              {
                "field": "line_total",
                "weight": 1.5,
                "style": {
                  "align": "right"
                }
              }
            ]
          },
          {
            "type": "fields",
            "fields": [
              {
                "field": "subtotal",
                "weight": 1,
                "style": {
                  "align": "right"
                }
              },
              {
                "field": "tax",
                "weight": 1,
                "style": {
                  "align": "right"
                }
              },
              {
                "field": "amount",
                "weight": 1.3,
                "style": {
                  "align": "right",
                  "size": "large",
                  "background": "#EDF4FA",
                  "border_color": null
                }
              }
            ]
          }
        ]
      },
      {
        "title": "Payment and verification",
        "title_style": {
          "background": "#193550",
          "foreground": "#FFFFFF",
          "border_color": null,
          "padding_mm": 1.8,
          "border_radius_mm": 0.7,
          "font_size": 9
        },
        "rows": [
          {
            "type": "fields",
            "fields": [
              {
                "field": "payment",
                "weight": 1.1,
                "style": {
                  "size": "small"
                }
              },
              {
                "field": "terms",
                "weight": 1.4,
                "style": {
                  "size": "small"
                }
              }
            ]
          },
          {
            "type": "fields",
            "fields": [
              {
                "field": "verification",
                "weight": 1,
                "style": {
                  "align": "center",
                  "size": "small",
                  "background": "#F2F6FA",
                  "border_color": null
                }
              },
              {
                "field": "reference_barcode",
                "weight": 2,
                "style": {
                  "align": "center",
                  "size": "small",
                  "background": "#F2F6FA",
                  "border_color": null
                }
              }
            ]
          },
          {
            "type": "footer",
            "left": "Harbor Engineering Services Ltd. | Sample invoice",
            "center": "Amounts in USD",
            "page_number": true
          }
        ]
      }
    ]
  },
  "data": {
    "invoice_number": "INV-0042",
    "issued": "2026-10-19",
    "customer": "Meridian Contractors",
    "amount": 5747.5,
    "status": "Issued",
    "sender": {
      "name": "Harbor Engineering Services Ltd.",
      "lines": [
        "22 Waterfront Avenue, Beirut",
        "Accounts: accounts@example.com",
        "Tax registration: DEMO-10428"
      ]
    },
    "recipient": {
      "name": "Meridian Contractors S.A.L.",
      "lines": [
        "Attn: Accounts Payable",
        "Marina Heights - Tower A",
        "billing@example.com"
      ]
    },
    "purchase_order": "PO-MH-0187",
    "project": "Marina Heights / Engineering",
    "due_date": "2026-11-18",
    "subtotal": 5225,
    "tax": 522.5,
    "items": [
      {
        "item": "Site survey and setting-out verification",
        "quantity": 1,
        "price": 650,
        "line_total": 650
      },
      {
        "item": "Structural / MEP coordination drawing review",
        "quantity": 4,
        "price": 300,
        "line_total": 1200
      },
      {
        "item": "Site inspection and technical report",
        "quantity": 3,
        "price": 275,
        "line_total": 825
      },
      {
        "item": "Material submission review",
        "quantity": 5,
        "price": 140,
        "line_total": 700
      },
      {
        "item": "Monthly engineering support - October 2026",
        "quantity": 1,
        "price": 1850,
        "line_total": 1850
      }
    ],
    "payment": "Bank transfer within 30 days.\nAccount: Harbor Engineering Services Ltd.\nUse INV-0042 as the payment reference.",
    "terms": "Services completed under PO-MH-0187.\nSupporting records: TS-1026-04 and SR-018.\nDemo document - bank details intentionally omitted.",
    "verification": "https://example.com/verify/INV-0042",
    "reference_barcode": "INV-0042"
  }
}
