1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! Post-acceptance obligation builders for GPKE processes.
//!
//! These helpers encode the BDEW GPKE Teil 3/4 mandatory follow-up obligations
//! that arise when an NB accepts specific inbound processes. Keeping obligation
//! construction separate from the workflow state machine allows
//! [`crate::GpkeSupplierChangeWorkflow`] to remain a pure state machine without
//! cross-process PID knowledge.
//!
//! Callers (transport adapters, integration tests, examples) invoke these
//! builders to compute the `obligations` slice passed to
//! [`crate::SupplierChangeCommand::SendAntwort`].
//!
//! # Example
//!
//! ```rust,ignore
//! use mako_gpke::post_acceptance;
//! use mako_gpke::SupplierChangeCommand;
//!
//! let obligations = post_acceptance::lieferbeginn_obligations(
//! anfrage_pid.as_u32(),
//! &data.location_id,
//! &data.new_supplier,
//! Some(&msb_gln),
//! );
//! process.execute(SupplierChangeCommand::SendAntwort {
//! accepted: true,
//! reason: None,
//! obligations,
//! }).await?;
//! ```
use ;
/// Build the GPKE Teil 3 + 4 post-acceptance obligations for a
/// `Lieferbeginn Strom` acceptance (anfrage PID 55001).
///
/// Returns an empty `Vec` when `anfrage_pid != 55001` — other
/// Prüfidentifikatoren do not carry Teil 3/4 obligations.
///
/// # Obligations (BDEW GPKE / BK6-22-024)
///
/// - **MSCONS 13015** — "Bewegungsdaten im Kalenderjahr vor Lieferbeginn Strom":
/// The NB delivers historical movement data to the new LFN before the supply
/// start date. Always emitted when the anfrage PID is 55001 and accepted.
///
/// - **ORDERS 17134** — "Einrichtung Konfiguration aufgrund Zuordnung LF (NB an
/// MSB)": The NB orders the MSB to configure the metering point for the new
/// supplier assignment. Emitted only when `msb_gln` is `Some`.
///
/// Both entries are intended to be passed as `obligations` to
/// [`crate::SupplierChangeCommand::SendAntwort`] so they are co-persisted
/// atomically with the `AntwortGesendet` event via the outbox.
///
/// # Parameters
///
/// - `anfrage_pid` — The Prüfidentifikator of the inbound ANFRAGE (e.g. `55001`).
/// - `malo` — The Marktlokation identifier for the delivery point.
/// - `new_supplier` — The GLN/EIC of the incoming Lieferant (LFN).
/// - `msb_gln` — The GLN/EIC of the Messstellenbetreiber (MSB). Pass `None`
/// when the MSB is unknown at dispatch time; the ORDERS 17134 obligation is
/// then omitted and must be fulfilled via a separate process.