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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//! Types shared by every TM Forum domain.
//!
//! This module is pure data: no I/O, no async, no HTTP. It builds cleanly for
//! `wasm32-unknown-unknown` and is the only module the domain models depend on.
//!
//! # The three shapes of a resource
//!
//! TMF v5 defines each resource three times, and this crate mirrors that:
//!
//! | OAS schema | Rust type | Used for |
//! |---|---|---|
//! | `ProductOffering` | [`ProductOffering`] | `GET` responses |
//! | `ProductOffering_FVO` | [`ProductOfferingCreate`] | `POST` bodies |
//! | `ProductOffering_MVO` | [`ProductOfferingUpdate`] | `PATCH` bodies |
//!
//! The variants differ in which members exist and which are *required*: a
//! create body must carry `name` and `lifecycleStatus`, while a patch body must
//! not carry `id` or `href` at all. Encoding that in the type system means the
//! compiler rejects a malformed request before it reaches the wire.
//!
//! # What else lives here
//!
//! Two types that look like client concerns are here rather than in
//! [`crate::api`], because they are I/O-free wire data and the layering rule is
//! about I/O rather than about topic:
//!
//! - [`TmfEvent`] — the notification envelope. A webhook handler, a queue
//! consumer or a server implementation needs it without an HTTP client;
//! *registering* a subscription is the client's job.
//! - [`JsonPatchOp`] — an RFC 6902 operation. Which of the four v5 `PATCH`
//! content types a list is sent under is the client's concern.
//!
//! Both are re-exported from [`crate::api`], so client-side code has one import
//! path.
//!
//! # Reference target markers
//!
//! A `ProductOffering` carries a `ChannelRef` into sales-channel management; a
//! `Customer` carries an `AccountRef` into TMF666. Neither API defines the
//! target, only a reference to it. So this module declares zero-sized markers —
//! [`Channel`], [`Place`], [`Promotion`], [`Quote`] and the rest — which give
//! [`Ref<T>`](Ref) a target so the reference stays typed, and which carry the
//! `@type` and `@referredType` values the v5 schemas expect.
//!
//! They live here rather than in a domain module because the same target is
//! referenced from several domains: `Place` appears in both product and party
//! payloads.
//!
//! **A marker is usually a placeholder, not a destination.** When this crate
//! grows a real model for the API that owns the target, the marker is deleted
//! and the references repoint at the real type — which is what happened to
//! `ResourceSpecification` and `ResourceCandidate` when TMF634 arrived, and to
//! `Account` when TMF666 did. That is also what makes
//! [`resolve`](crate::api::ResolveRef::resolve) start working for them: a
//! marker has no collection to fetch from, and a real type does.
//!
//! Two are **not** placeholders and will not go away. [`BillingAccount`] and
//! [`FinancialAccount`] are subclasses of a type this crate *does* model, and
//! TM Forum gives each its own `…Ref` class. Since `Ref<T>` binds one target
//! type to one class name, a reference to a subclass needs a target of its own
//! even when the entity itself is modelled.
//!
//! [`ProductOffering`]: crate::product::ProductOffering
//! [`ProductOfferingCreate`]: crate::product::ProductOfferingCreate
//! [`ProductOfferingUpdate`]: crate::product::ProductOfferingUpdate
pub use ;
pub use ;
pub use TmfError;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Ref;
pub use ;
pub use ItemAction;
pub use ;
pub use ;
/// A body that a `PATCH` may carry as a whole-resource merge.
///
/// Implemented by the `…Update` type of every resource — the v5 `_MVO` schema —
/// and by nothing else. That is what lets
/// [`Patch`](crate::api::Patch) accept `&update` and `&[JsonPatchOp]` through
/// the same argument without the two conversions colliding, and it stops a
/// `PATCH` being handed a body that is not a patch body at all.
/// A TM Forum resource that is addressable by `id` and `href`.
///
/// Implemented by the read model of every top-level resource, which is what
/// makes generic helpers such as [`Entity::reference`], pagination and the mock
/// server possible without naming each resource individually.