# Contracts

The role contracts of the Open Utility Stack, and the definitions they share. Data
only: JSON Schema (draft 2020-12) plus examples and probes, no crate. Nobody links
this folder; a platform generates or writes its own types and checks them against the
schemas in CI (conventions G1).

The rules these contracts follow are on the site's
[Conventions](https://hupe1980.github.io/open-utility-stack/docs/conventions/) page.
Ports and events that belong to one platform stay in that platform's repository.
The site serves this folder as is: link a file as
`https://hupe1980.github.io/open-utility-stack/contracts/<path>` (for example
`…/contracts/common/energy-sharing.md`), never as a path into a checkout.

**Vendor, don't fetch at build time.** Copy the files you use into your repository
(all of them: [`contracts.tar.gz`](https://hupe1980.github.io/open-utility-stack/contracts.tar.gz)),
note the umbrella commit beside them, and let CI compare your copy with the served one
and flag a difference: your build stays reproducible, and a change here still shows.

```text
contracts/
  catalog.toml          every contract here: name, major version, schema, example, probe
  check.py              checks every schema, example and invalid case; or your own documents
  common/               money, time, references; market correlation; energy sharing; digests
  profiles/             one schema, one example and one set of invalid cases per role contract
```

## Check

```sh
just contracts                                          # everything in catalog.toml
uv run contracts/check.py order@1 my-event-data.json    # your documents against one profile
```

A probe is the example plus its `.invalid.json` cases. A producer's documents must
conform, and a consumer's parser should refuse every invalid case.

## Identity and versions

- **`dataschema` is the schema's `$id`**: `urn:open-utility-stack:<name>:<major>`, such
  as `urn:open-utility-stack:order:1`. Consumers route on it, exactly (G2).
- **Versions** follow the Conventions page, "Contract versions": additive keeps the
  URI, breaking is a new major with a new file and URI. Before production the old one is
  removed in the same release (a hard cut); from the first production deployment it stays
  supported for 12 months.
- **`subject`** is the `client_reference` on `order@1` and `appointment@1` (they report a
  command's outcome, REF-2), and the `product.id` on `product-lifecycle@1` (it is about
  the product; the order's reference is in `data`).
- **Where the parties come from.** The creditor (the tenant whose claim or contract it
  is) is the tenant in the event `source` (CE-1): `https://estate.example/tenants/swm/mako`.
  The contract account is `data.account` where the producer knows it; otherwise the
  account system resolves it from the profile's own reference (`source_reference`,
  `product.id`). Neither is ever read from `subject`.

| Profile | `subject` | `partitionkey` |
|---|---|---|
| `order@1` | `client_reference` | the order (`order.id`) |
| `product-lifecycle@1` | `product.id` | `product.id` |
| `product-notice@1` | `product.id` | `product.id` |
| `appointment@1` | `client_reference` | `client_reference` |
| `rated-charge@1` | `client_reference` | `source_reference` |
| `collection-terms@1` | `contract` | `contract` |
| `erasure@1` | `client_reference` when set; never the person | not set |
| `erasure@1#Confirmation` | `erasure` (the erasure event's `id`) | not set |

- **Every document names its profile** (`"profile": "order@1"`), so a payload stored
  without its envelope still says what it is.
- **Extensions** go in `extensions`, one object per namespace: a sector (`energy`) or an
  emitter (`de.mako`). Nothing outside the profile appears at the top level.

## Profiles

### `order@1`: an order changed state

TMF622 Product Ordering v5. The contract system emits it, whichever engine it is; the
party that handed the order over consumes it. This is G5: a hand-over is acknowledged
at once, and its outcome arrives later as events.

| `state` | Meaning |
|---|---|
| `acknowledged` | received and checked for form |
| `rejected` | refused before work began (needs `reason`) |
| `inProgress` | accepted and being carried out |
| `held`, `pending` | waiting on someone else (`held` needs `reason`) |
| `completed` | finished: every item delivered |
| `partial` | finished: some items delivered, some failed (needs `reason`) |
| `failed` | finished: every item failed (needs `reason`) |
| `cancelled` | withdrawn, such as a § 355 BGB Widerruf (needs `reason`) |

`completed`, `partial` and `failed` are end states: while any item is still open, the
order stays `inProgress` and its items carry their own states. A completed item carries
`effective`, the day it took effect (the supply start of an `add`), whenever the emitter
knows it: a commission falls due on that day, and the product event that also carries
it may arrive later.

**The request.** The order itself, the command a party hands over, is
`order@1`'s `$defs/Request` (`urn:open-utility-stack:order:1#/$defs/Request`). It goes
over REST with `Idempotency-Key` equal to its `client_reference` (REF-3); the answer is
an acknowledgement, and the outcome arrives as the events above.

**Suspend and resume.** The account system (konto) asks an engine to suspend a supply
with a `suspend` item: the product, and a `suspension` with the earliest date, the
reviewer's id, the decision date and the evidence digest. A person decided it (D2);
their reasons stay in konto. The engine performs the stop under its own law and answers
with order@1: `completed` once the supply is suspended (with product-lifecycle@1
`suspended`), or `rejected` with one of these reason codes:

| `reason.code` | Meaning |
|---|---|
| `suspension.too-early` | before `earliest`, or before the law's leads have run |
| `suspension.protected` | the engine's law forbids it for this customer (hardship, a medical case) |
| `suspension.below-minimum` | the engine's own view of the claim is below the minimum |
| `suspension.disputed` | the claim is disputed in the engine |
| `suspension.not-active` | the product is not active |
| `suspension.unknown-product` | the engine does not hold the product |

`resume` lifts it the same way, with only the product. `suspend` and `resume` are the
profile's own item actions: TMF622's `ItemActionType` has only `add`, `modify`, `delete`
and `noChange`, and TMF does a suspension as `modify`.

### `product-lifecycle@1`: a product changed state

TMF637 Product Inventory v5. A product is a supply contract, a line or a charging
contract. The state names are TMF637's (its v5 OpenAPI file spells `'aborted '` with a
trailing space; the profile does not). TMF documents no transitions; the diagram below
is the profile's, including `pendingTerminate` back to `active` when a Kündigung is
withdrawn. Every contract system emits it under its own `type` names; consumers route by
`dataschema`.

```text
created ──► pendingActive ──► active ──► pendingTerminate ──► terminated
   │              │             │  ▲            │
   │              │             ▼  │            └──► active   (termination withdrawn)
   │              │          suspended
   └──► cancelled └──► aborted
```

`effective` is the business date the state takes effect (a Lieferbeginn, a Lieferende),
with its zone. `client_reference` is present when an order caused the change.

- **Who terminated.** `pendingTerminate` requires `reason.code`:
  `terminated-by-customer`, `terminated-by-supplier`, `withdrawn` or `other`. A
  customer's Kündigung is a win-back moment, a supplier's is not.
- **A withdrawal says so.** Every product event a Widerruf causes carries `reason.code`
  `withdrawn`, whatever its state: a `pendingTerminate` without it is a Kündigung.
- **No personal data in the event (G7).** An Ersatzversorgung names the product, the
  account and the Marktlokation, never a name or address. A consumer that must reach
  the household asks the account system for the account's contact, with its own
  credentials, under its own legal basis; the event carries no link to the data.

### `product-notice@1`: a product's terms change, its term ends or renews

The stack's own profile beside `product-lifecycle@1`, for facts that change no state but
open or close a sales moment. Usually announced ahead, so `effective` may lie in the
future.

| `notice` | `effective` | What it means for a sales system |
|---|---|---|
| `price-change` | the day the new prices apply | the customer may terminate (§ 41 EnWG), unless `pass_through` says the change only passes on a VAT rate (`vat-rate`) or a relief (`aggregate-relief`) |
| `term-ends` | the last day of the fixed term | time for a renewal offer |
| `renewed` | the first day of the renewed term | the term renews; no offer |
| `move` | the move-out day | the customer takes or ends the contract (§ 41b EnWG) |

### `appointment@1`: a field visit was agreed, done, failed or called off

TMF646 Appointment (v4). Any field-service system emits it; any role that ordered the
visit consumes it. It carries what a receiver that owes or refuses compensation for a
missed visit decides by (§ 58 TKG): the day, the slot, the firm, whose side a failure
fell on, and whether that is disputed.

| `status` | Allowed |
|---|---|
| `confirmed` | `on`, `from` and `until` or `half_day`, `performer`; no `reason`, `responsible` or `disputed` |
| `completed`, `failed` | `on`, `performer`, `reason`, `responsible`, `disputed`; no slot |
| `cancelled` | as `failed`, plus `cancelled_at` (UTC) and `cancelled_by` (`firm`, `client`, `customer`) when known |

- **`on` per status:** `confirmed` the agreed day; `completed` and `failed` the day of
  the visit; `cancelled` the day it was called off. The day that was called off is the
  latest `confirmed`'s `on`, so a consumer can tell a cancellation on the day itself
  from one a week before (§ 58 TKG).
- **The latest `confirmed` holds.** A move to another day is a new `confirmed` with the
  same `client_reference`. Consumers order the events of one reference by `sequence`
  (CE-9; `partitionkey` is the reference), never by `time`; an emitter that can send
  more than one `confirmed` sets `sequence`.
- **`client_reference` links the statuses, `appointment.id` does not.** The id is the
  sender's own and may change from the job (`confirmed`, `cancelled`) to the visit
  (`completed`, `failed`).

### `rated-charge@1`: one rated line before invoice rounding

`rated-charge@1` carries one settlement-period line before invoice rounding. A negative net value is a credit. The amount is a decimal string and `scale` is its number of fractional digits. The VAT rate is a fraction. Both service dates are inclusive in the stated time zone. When mapping to TMF635 v5, put the signed net in the duty-free amount of the usage product price and multiply the fractional tax rate by 100.

`client_reference` identifies the line within the producer and tenant. Replaying the same source yields the same reference. `rating_evidence_digest` identifies the producer’s rating evidence. `source_reference` identifies the contract, supply point or dispatch. Sector details belong in `extensions`.

Run `uv run contracts/check.py` for the catalogue and its rejection examples. Use `uv run contracts/check.py rated-charge@1 charge.json` for a producer. [Schema](profiles/rated-charge@1.schema.json) · [TMF635 Product Usage Management v5](https://www.tmforum.org/open-digital-architecture/open-apis/usage-management-api-TMF635/v5.0)

### `collection-terms@1`: when an overdue claim may lead to a suspension

The stack's own profile; no standard covers it. Each contract system states, per
contract, the rules its law sets: the minimum overdue amount (a fixed amount, a multiple
of the instalment, a fraction of the annual bill; the highest applies), what never
counts towards it, the threat and announcement leads in calendar, working (Monday to
Saturday) or business days, whether a suspension is possible at all, the instalment
plan that must be offered, and the text blocks the letters must carry. konto evaluates
the terms and proposes a suspension; it never knows how a Sperrung works.

### Rated charges: corrections, quantities and exemptions

- **A line is never edited.** A re-rating is a new line whose `corrects` names the
  corrected line's `client_reference`; the bill shows it as a correction. It carries
  the difference, so the line and its corrections add up to the right amount
  (`rated-charge@1.correction.example.json`: 6.543211 kWh more shared, 0.78518532 EUR
  more credit). It keeps the corrected line's tax category and rate, also across a VAT
  rate change. On the invoice, the account system resolves `corrects` to the invoice
  that billed the corrected line and names it as the preceding invoice (EN 16931 BG-3:
  BT-25 number, BT-26 date; XRechnung BR-DE-26 for a corrected invoice, type 384), which
  § 31 Abs. 5 UStDV asks for ("spezifisch und eindeutig"). Call a credit a credit:
  *Gutschrift* means self-billing in German VAT law.
- **`quantity` and `unit_price`** (both or neither) let a bill show "312.4 kWh × 0.3120 EUR"
  and a variance separate quantity from price. The unit is a UN/ECE Recommendation 20
  code (`KWH`, `MTQ`, `MON`); the unit price is never negative, so a credit has a
  negative quantity (EN 16931 BR-27).
- **Example digests.** The sharing, reverse-charge and correction examples are billingd's
  output (`mako/services/billingd/tests/fixtures/rating/`): their `client_reference`
  and `rating_evidence_digest` reproduce from billingd's synthetic inputs
  (`cargo test -p billingd --lib catalogue_cases`). The not-subject example still
  carries placeholder digests; only its shape and arithmetic are checked.
- **`tax_exemption`** (`text`, `code` from the VATEX list) is required for categories
  `E`, `AE` and `O`, and absent otherwise (EN 16931 BT-120, BT-121).
- **A not-subject (`O`) line never shares an invoice with taxed lines** (EN 16931
  BR-O-11, BR-O-12): such an invoice has no other VAT group, no seller VAT id (BR-O-02),
  and its lines carry no rate (BR-O-05: the EN 16931 mapping drops `tax_rate`, which is
  `0` in the profile). A dunning fee (`rated-charge@1.not-subject.example.json`; UStAE
  1.3 Abs. 6) goes on its own document, such as the dunning notice, not on the energy
  bill. `check.py` refuses a `bill@1` that mixes `O` with another group.
- **Reverse charge for electricity** (`AE`, VATEX-EU-AE) applies only when both supplier
  and recipient are resellers of electricity (§ 13b Abs. 2 Nr. 5 Buchst. b, Abs. 5 with
  § 3g UStG).

### `bill-section@1` and `bill@1`: one bill for every sector

Each contract engine supplies a **`bill-section@1`** for its contract: the heading, the
facts and texts its sector's law requires on every bill (§ 40 EnWG, § 62 TKG,
AVBWasserV, AVBFernwärmeV, FFVAV), and the norms they come from. It carries no money:
amounts arrive as `rated-charge@1`. The account system places the section unchanged and
knows no sector law.

The account system issues **`bill@1`** (TMF678 Customer Bill; the EN 16931 invoice is
attached under `documents`). It is built to be checked by anyone:

- every line names the `rated-charge@1` it bills (`charge`, optionally `charge_digest`);
- **amounts are rounded once, on the line, to the cent**, half away from zero;
  quantity × unit price must give the line's net;
- each section's net is the sum of its lines, each VAT group's base the sum of its
  lines, its tax the base times the rate rounded once per group (EN 16931 BG-23);
- net, VAT, gross, prepaid and payable follow from those, and prepaid is the sum of
  the payments; a negative payable is a credit;
- **array order is fixed, because the digest keeps it**: sections as the bill shows them,
  lines in section order, VAT groups in the order the lines first use them, payments as
  applied;
- **a section key is unique within a bill**: a producer with two contracts on one account
  (a household and a heat-pump tariff) gives each its own key;
- names, addresses and bank details are not in it (G7): they are in the attached
  invoice, behind the account reference.

`check.py` recomputes all of it, so a probe refuses a bill that does not add up, and
recomputes the example's digest (`common/digest.md`) against the catalogue's test
vector. The example is konto's household fixture: power, water and fibre on one bill,
a correction of December, two Abschläge, 27.71 EUR payable.

### The flexibility market: `flex-prognosis@1`, `flex-request@1`, `flex-offer@1`, `flex-order@1`, `flex-settlement@1`

Profiles of UFTP 3.1's D-Prognosis, FlexRequest, FlexOffer, FlexOrder and FlexOrderSettlement: the
data the DSO role (fms) and the aggregators (flexpool) exchange. The platforms map onto
them; the crates underneath are standalone: `uftp` speaks the signed XML wire and
`flexibility` computes the numbers, and neither knows the profiles. They share
`common/flex.schema.json`: the market context (congestion point, day and zone, ISP length,
sender, recipient, message id), ISP spans and powers.

- **One sign**: power in whole watts, positive is consumption (UFTP § 4.2.1); a flex
  power is negative for less consumption.
- **A chain of references**: the offer quotes the request's message id, the order the
  offer's and its option, the settlement the order's `client_reference` (UFTP's
  OrderReference).
- **A requested band is a deviation with one direction** (UFTP § 3.8.2, as `uftp`
  enforces it): `min_power`/`max_power` bound the deviation from the baseline, not
  absolute power; a requested ISP asks for less (`max_power` ≤ 0) or more (`min_power`
  ≥ 0), never both. The example asks for −8 to −2 MW in ISPs 69–73, and the offer's
  −2 MW lies in it.
- **A baseline is named, never implied**: a D-Prognosis message or a method id.
  `common/flex` lists the ids: `dprognosis@1`, `schedule@1`, `mbma@1`, `xofy@1`; any
  other only by bilateral contract. The settlement uses the order's baseline; the example
  chain names `dprognosis@1` throughout.
- **The D-Prognosis travels as `flex-prognosis@1`**: the aggregator sends the power it
  expects per ISP for the whole day, from ISP 1 without a gap, before any order, and
  counts `revision` up with each new one. `dprognosis@1` settles against the highest
  revision the DSO received before the order; `baseline.d_prognosis` names one message by
  its `market.message_id`. The example expects 10 MW in ISPs 69–73, the settlement
  example's baseline.
- **Settlement exactly as § 2.6**, per ISP, with *o* the ordered flex power and *r* the
  deviation along it, `(actual − baseline) · sign(o)`:
  delivered = clamp(*r*, 0, |*o*|) · sign(*o*); deficiency = max(0, |*o*| − *r*), a
  non-negative magnitude. UFTP leaves the sign of deficiency open (uftp's spec note
  SS-25); the profile fixes it. Net settlement is price minus penalty. `check.py`
  recomputes every ISP, so both sides can prove a settlement before comparing digests.
- **`settlement_digest`** is the `common/digest.md` digest of the document without that
  field. Each side builds the document from its own settlement and compares; `check.py`
  recomputes it when present.

- **The activation factor applies once, at settlement**, as on the wire (uftp SS-26): an
  order carries the option's power and price unscaled; the settlement's
  `ordered_flex_power` is that power × the factor, rounded half away from zero to whole
  watts, and its `price` is the order's price × the factor.
- **One settlement document per order.** A UFTP FlexSettlement settles every order of its
  period under one message id, so several documents share `market.message_id`. Their
  CloudEvents `id` is `<market.message_id>/<client_reference>`, and consumers deduplicate
  on `source` + that `id` (CE-1).
- **Lossless back to the wire:** `market.conversation_id` carries UFTP's ConversationID;
  an offer's creation time is the event's `time`. A request ISP's `disposition` is
  required; a mapping from a UFTP message without one refuses it, never guesses.

The settlement example is UFTP's own: 2 MW ordered down from a 10 MW baseline, actual 7, 8,
9, 10 and 11 MW, delivered −2, −2, −1, 0 and 0 MW, deficiency 0, 0, 1, 2 and 3 MW.

### `erasure@1`: a person's data was erased, and every consumer follows

Every role that holds personal data emits it, and every consumer of that role's events
acts on it (G7; Art. 17(2) and Art. 19 GDPR). It names the person only by references the
consumers already hold (`subject`, `also_known_as`), says why (`basis`) and what the
emitter itself keeps and until when (`retained`, for information). Each consumer answers
with a `#/$defs/Confirmation`: `erased`, `anonymised`, `none-held`, or `retained` with
what it keeps under which norm. Destroying a key (crypto-shredding) is defence in depth,
not proof of erasure.

- **The confirmation event** carries `dataschema`
  `urn:open-utility-stack:erasure:1#/$defs/Confirmation` (CE-3 allows the fragment).
- **References** name what the consumer holds: a person or account, and for grid and
  device roles a `metering-point` (Marktlokation, Messlokation), a `unit` (an EMS
  target, a market resource such as a TR-ID) or a `device` (a smart meter gateway, a
  meter serial, a controllable device's identifier).
- **`confirm_to` is informational.** A consumer sends its confirmation only over the
  subscriptions its operator configured, never to a URL taken from the event, which
  would let any authenticated sender point it at an arbitrary host. It may use the value
  to choose among configured endpoints.
- **`retained.until` is the latest date anything is kept.** Where a norm keeps records
  per measure (BK6-22-300 Anlage 1 Ziffer 7.3: two years after each reduction), it is the
  last measure's date plus that period. `common/retention.md` lists the norm and period
  per record kind (vouchers eight years, books ten, letters six), so every role answers
  with the same entries.
- **`pending` when a person must still act** (an operator at the consumer, not the data
  subject: a row in a reviewed portfolio file, a
  supervised removal, a premises in a DSO's export): the consumer starts no new use,
  answers `pending` with `expected_by`, and sends the final answer for the same `erasure`
  by that date. A process already reading the data (a monitor reading the export) may run
  until the person's action removes it; that action is what ends the use. An emitter can
  then tell a slow consumer from a silent one.
- **Use a norm requires is `retained`, not `pending`.** If an obligation keeps the data in
  use (§ 14a control of a connection still linked to the person), the final answer is
  `retained` with that basis. `pending` only covers the time a person needs to act.
- **`erasure` names the erasure event's CloudEvent `id`.** An emitter that answers over
  HTTP without its own bus records the erasure under an id and uses it as the event `id`;
  the relay that emits it keeps that `id`.
- **Which answer, for a record you keep:** `erased` when the record is gone;
  `anonymised` when you keep it but deleted your own link to the person, and what is left
  links to them only through another role's mapping (a gateway id in a dispatch audit,
  once the metering-point binding is gone); `retained` when you can still link it
  yourself and a norm makes you keep it. Pseudonymous data stays personal data for whoever
  holds the key (Recital 26 GDPR); that holder answers for it.
- **Each role answers only for its own mappings.** A DSO that erases its premises mapping
  confirms `anonymised` even though a meter id stays linkable for the metering point
  operator, who answers for that mapping in its own confirmation.

### Classification

Every catalogue entry states the `classification` its events carry in the envelope
(conventions CE-6), and `check.py` refuses an entry without one. A reference to a
person's contract or account is personal data, so everything about a customer is
`confidential`, `dataregulation: GDPR`, `datacategory: standard`; the flexibility
profiles carry no person and are `internal` (a request) or `confidential` (prices).

### `flex-register@1`: who may sell flexibility, and with which units

A grid operator's registers of service providers and controllable units, as one file it
serves read-only (fms): each unit's connection (Marktlokation, Redispatch TR-ID, the
congestion point), its technology and power limits in watts, its baseline method, and
what it and its provider are prequalified for, by whom and until when. `check.py`
refuses a unit whose provider is not listed, a duplicate id and a qualification that
ends before it starts. Units sit in homes, so the file is GDPR data, served only to the
providers and the operator. A national register will replace the file; the shapes stay.

## mako's contract events onto the profiles

mako keeps its `type` names (`de.mako.vertrag.*`). Where an event is a state change of
an order or a product, it is emitted with the profile's `dataschema` and data, and
mako's own fields move under `extensions["de.mako"]`. Where one fact changes both an
order and a product, mako emits one event per profile: each with its own `id`, the same
`correlationid`; `subject` is the `bestellreferenz` on `order@1` (the command's outcome,
REF-2) and the `vertrag_id` on `product-lifecycle@1`, which still carries the order's
`client_reference`. A contract without a Bestellung (created by an operator) has no
`order@1` event and no `client_reference`.

| mako event | Profile | State | `effective` / note |
|---|---|---|---|
| `bestellung.eingegangen` | order@1 | `acknowledged` | |
| `bestellung.abgelehnt` | order@1 | `rejected` | `reason.code` `order.refused`; `grund` stays in `de.mako` |
| `bestellung.angenommen` | order@1 and product-lifecycle@1 | order `inProgress`, item `add` with the new `vertrag_id`; product `created` | the Vertragsschluss; `created` has no `previous_state` |
| the contract's creation without a Bestellung | product-lifecycle@1 | `created` | the creation date; mako names the event |
| `lieferbeginn.bestaetigt` | product-lifecycle@1, and order@1 if a Bestellung exists | product `pendingActive`; the component's item `completed`; the order `completed` only when every item is, else `inProgress` | `lieferbeginn`, also as the item's `effective`; one component per event |
| `lieferbeginn.abgelehnt` | order@1 | the item `failed`; the order stays `inProgress` while another item is open, then `partial` (some delivered) or `failed` (none) | `reason.code` `market.rejected`; `antwortcode`, `codeliste` stay in `de.mako` |
| `aktiv` | product-lifecycle@1 | `active` | the supply start |
| `ersatzversorgung.begonnen` | product-lifecycle@1 | `active` | `lieferbeginn`; `reason.code` `ersatzversorgung`; no `client_reference` |
| `gekuendigt` | product-lifecycle@1 | `pendingTerminate` | `lieferende`; `reason.code` `terminated-by-customer` or `terminated-by-supplier` |
| `kuendigung-widerrufen` | product-lifecycle@1 | `active`, previous `pendingTerminate` | the day of the withdrawal |
| `belieferung.beendet` | product-lifecycle@1 | `terminated` | the last component's Lieferende (status `ABGELAUFEN`) |
| `widerruf.eingegangen`, `wirkung` `STORNIERT` | order@1 and product-lifecycle@1 | order `cancelled`; product `cancelled` | `reason.code` `withdrawn` |
| `widerruf.eingegangen`, `wirkung` `LIEFERENDE` | product-lifecycle@1 | `pendingTerminate` | the Lieferende the withdrawal set; `reason.code` `withdrawn` |
| `widerruf.eingegangen`, `wirkung` `BESTELLUNG_GESCHLOSSEN` | order@1 | `cancelled` | `reason.code` `withdrawn` |

A late withdrawal (`rechtzeitig: false`, no `wirkung`) changes no state: mako's own
schema only. `zuordnung.beendet` ends one component, not the product, and keeps mako's
schema too; the product ends with `belieferung.beendet`.

| `de.mako.vertrag.*` | Profile | `notice` | `effective` |
|---|---|---|---|
| `preisaenderung.ankuendigung` | product-notice@1 | `price-change`, with `pass_through` when the change only passes on a VAT rate or a relief | the day the new prices apply |
| `ablauf.ankuendigung` | product-notice@1 | `term-ends` | the last day of the term |
| `autoerneuerung.ankuendigung` | product-notice@1 | `renewed` | the first day of the renewed term |
| a move (no mako event yet) | product-notice@1 | `move` | the move-out day |

The other `de.mako.vertrag.*` events (tariff changes, Kündigung received, the
Vorversorger and Neulieferant steps) keep mako's own schemas.

## esales' field-work events onto `appointment@1`

| `de.esales.montage.*` | `status` | Field changes |
|---|---|---|
| `termin` | `confirmed` | `on` becomes `{date, zone}`; `firm` becomes `performer` |
| `erledigt` | `completed` | as above |
| `gescheitert` | `failed` | as above; `reason`, `responsible`, `disputed` unchanged |

The `de.esales.montage.*` types are removed when `appointment@1` lands (a hard cut,
before production). A field-service
system emits `appointment@1` under its own types, and esales and telco route on the
`dataschema`. That removes the coupling where telco accepted only esales' type names
and a field-service system had to pretend to be esales.
