Template data

The JSON document every PDF template reads: data contract version 2. Version 2 only adds keys to version 1, so an old template keeps working.

Rules for a reader

  • Every version 2 key can be null. Read data.contract?.version ?? 1 and hide a section the data does not have.
  • Energies in the simulation series are Wh; the kit's selectors give kWh. Money is in offer.currency (else the organisation's).
  • Personal data: agreement.customer.personal_id is a personnummer. Do not log the data.
  • The example houses in every template zip (sample-data/house-*.json) have this exact shape. Open one next to this page: house-1.json.

Version 1 keys

KeyWhat it holds
organisationThe installer: name, address, colours, currency.
managerThe offer's manager: name, e-mail, phone (null when not set: the kit's contact() then uses the organisation's).
prospectThe customer: name, address, phone, e-mail.
offerThe offer: number, dates, title, lines, adjustments, subtotals, grand_total, summary (kWp, battery kWh, inverter kW).
equipment[]The products on the lines, with their data sheets (power, warranty, images).
package, requirementThe package the offer came from, and the customer's requirements.
monthly_simulation, yearly_simulationThe energy simulation: production and use per month (Wh), and the 25-year economy (summary: costs, savings, balances).
screenshots[], attachments, colorsOlder images, the offer's attachments, the organisation's colours.

Version 2 keys

KeyWhat it holds
contract{version: 2, made_at, locale}. locale is sv or en (the organisation's).
siteThe address, the municipality, lat/lng, the house height, daylight_hours[12] and sun_path[12] (sunrise, sunset, the sun's noon height) on the 15th of each month.
imagesThe house images as data: URLs: views[] (pick by id: front, roofs, plan), aerial (null in production today), photos[] (the installer's house photos, at most 3), illustration. The kit's pictures(data) picks a cover.
economyThe bill without and with the system: year1 {cost_without, cost_with, savings} and monthly_bills {without[12], with[12], difference[12]}.
alternativesThe customer's other offers (at most 5) for a comparison: price, savings, payback, production.
wiringThe electrician's report: strings, checks, cables, protection suggestions (breakers, RCD type, fuses), diagrams as SVG.
structuralThe snow and wind loads per roof face (Boverket EKS 11 map values). Print them as facts only when availability is automatic or entered.
mountingThe mounting products and the hooks and rails per roof face.
bomThe bill of materials: items[] with group, key, title, qty, unit, source. Print cost only with settings.showCost.
agreementThe agreement's facts: the organisation (org number, F-skatt, insurance), the customer and co-customer, the property, the payment plan, the grön teknik subsidy, warranties, schedule and scope.

Settings

Settings are not data: the installer sets them per template and the app reads them with useSettings(). Examples: accent, logoDataUrl, showCost, compareOffers, termsHtml, lightPrint, photos, and scheme (the organisation's brand colours and fonts, applied by the kit's schemeAttrs()).

The types of every key are in the kit: kit/src/contract.ts (TemplateData) in each template zip, and AI-GUIDE.md explains them for an AI chat.