Skip to main content

backbone_pos/exports/
events.rs

1//! Public events for Pos module
2//!
3//! Generated by metaphor-schema. Do not edit manually.
4//!
5//! These events are published by this module for other modules to subscribe to.
6//! Events are the primary mechanism for cross-module communication.
7
8use serde::{Deserialize, Serialize};
9use chrono::{DateTime, Utc};
10
11use super::types::*;
12
13// ============================================================================
14// POSCLOSINGENTRY EVENTS
15// ============================================================================
16
17/// Event published when a PosClosingEntry is created
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct PosClosingEntryCreatedEvent {
20    pub id: PosClosingEntryId,
21    pub data: PosClosingEntryDto,
22    pub occurred_at: DateTime<Utc>,
23}
24
25/// Event published when a PosClosingEntry is updated
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct PosClosingEntryUpdatedEvent {
28    pub id: PosClosingEntryId,
29    pub data: PosClosingEntryDto,
30    pub occurred_at: DateTime<Utc>,
31}
32
33/// Event published when a PosClosingEntry is deleted
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct PosClosingEntryDeletedEvent {
36    pub id: PosClosingEntryId,
37    pub occurred_at: DateTime<Utc>,
38}
39
40// ============================================================================
41// POSINVOICE EVENTS
42// ============================================================================
43
44/// Event published when a PosInvoice is created
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct PosInvoiceCreatedEvent {
47    pub id: PosInvoiceId,
48    pub data: PosInvoiceDto,
49    pub occurred_at: DateTime<Utc>,
50}
51
52/// Event published when a PosInvoice is updated
53#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct PosInvoiceUpdatedEvent {
55    pub id: PosInvoiceId,
56    pub data: PosInvoiceDto,
57    pub occurred_at: DateTime<Utc>,
58}
59
60/// Event published when a PosInvoice is deleted
61#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct PosInvoiceDeletedEvent {
63    pub id: PosInvoiceId,
64    pub occurred_at: DateTime<Utc>,
65}
66
67// ============================================================================
68// POSINVOICEITEM EVENTS
69// ============================================================================
70
71/// Event published when a PosInvoiceItem is created
72#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct PosInvoiceItemCreatedEvent {
74    pub id: PosInvoiceItemId,
75    pub data: PosInvoiceItemDto,
76    pub occurred_at: DateTime<Utc>,
77}
78
79/// Event published when a PosInvoiceItem is updated
80#[derive(Debug, Clone, Serialize, Deserialize)]
81pub struct PosInvoiceItemUpdatedEvent {
82    pub id: PosInvoiceItemId,
83    pub data: PosInvoiceItemDto,
84    pub occurred_at: DateTime<Utc>,
85}
86
87/// Event published when a PosInvoiceItem is deleted
88#[derive(Debug, Clone, Serialize, Deserialize)]
89pub struct PosInvoiceItemDeletedEvent {
90    pub id: PosInvoiceItemId,
91    pub occurred_at: DateTime<Utc>,
92}
93
94// ============================================================================
95// POSPAYMENT EVENTS
96// ============================================================================
97
98/// Event published when a PosPayment is created
99#[derive(Debug, Clone, Serialize, Deserialize)]
100pub struct PosPaymentCreatedEvent {
101    pub id: PosPaymentId,
102    pub data: PosPaymentDto,
103    pub occurred_at: DateTime<Utc>,
104}
105
106/// Event published when a PosPayment is updated
107#[derive(Debug, Clone, Serialize, Deserialize)]
108pub struct PosPaymentUpdatedEvent {
109    pub id: PosPaymentId,
110    pub data: PosPaymentDto,
111    pub occurred_at: DateTime<Utc>,
112}
113
114/// Event published when a PosPayment is deleted
115#[derive(Debug, Clone, Serialize, Deserialize)]
116pub struct PosPaymentDeletedEvent {
117    pub id: PosPaymentId,
118    pub occurred_at: DateTime<Utc>,
119}
120
121// ============================================================================
122// POSPROFILE EVENTS
123// ============================================================================
124
125/// Event published when a PosProfile is created
126#[derive(Debug, Clone, Serialize, Deserialize)]
127pub struct PosProfileCreatedEvent {
128    pub id: PosProfileId,
129    pub data: PosProfileDto,
130    pub occurred_at: DateTime<Utc>,
131}
132
133/// Event published when a PosProfile is updated
134#[derive(Debug, Clone, Serialize, Deserialize)]
135pub struct PosProfileUpdatedEvent {
136    pub id: PosProfileId,
137    pub data: PosProfileDto,
138    pub occurred_at: DateTime<Utc>,
139}
140
141/// Event published when a PosProfile is deleted
142#[derive(Debug, Clone, Serialize, Deserialize)]
143pub struct PosProfileDeletedEvent {
144    pub id: PosProfileId,
145    pub occurred_at: DateTime<Utc>,
146}
147
148// ============================================================================
149// POSOPENINGENTRY EVENTS
150// ============================================================================
151
152/// Event published when a PosOpeningEntry is created
153#[derive(Debug, Clone, Serialize, Deserialize)]
154pub struct PosOpeningEntryCreatedEvent {
155    pub id: PosOpeningEntryId,
156    pub data: PosOpeningEntryDto,
157    pub occurred_at: DateTime<Utc>,
158}
159
160/// Event published when a PosOpeningEntry is updated
161#[derive(Debug, Clone, Serialize, Deserialize)]
162pub struct PosOpeningEntryUpdatedEvent {
163    pub id: PosOpeningEntryId,
164    pub data: PosOpeningEntryDto,
165    pub occurred_at: DateTime<Utc>,
166}
167
168/// Event published when a PosOpeningEntry is deleted
169#[derive(Debug, Clone, Serialize, Deserialize)]
170pub struct PosOpeningEntryDeletedEvent {
171    pub id: PosOpeningEntryId,
172    pub occurred_at: DateTime<Utc>,
173}
174
175// ============================================================================
176// POSCASHMOVEMENT EVENTS
177// ============================================================================
178
179/// Event published when a PosCashMovement is created
180#[derive(Debug, Clone, Serialize, Deserialize)]
181pub struct PosCashMovementCreatedEvent {
182    pub id: PosCashMovementId,
183    pub data: PosCashMovementDto,
184    pub occurred_at: DateTime<Utc>,
185}
186
187/// Event published when a PosCashMovement is updated
188#[derive(Debug, Clone, Serialize, Deserialize)]
189pub struct PosCashMovementUpdatedEvent {
190    pub id: PosCashMovementId,
191    pub data: PosCashMovementDto,
192    pub occurred_at: DateTime<Utc>,
193}
194
195/// Event published when a PosCashMovement is deleted
196#[derive(Debug, Clone, Serialize, Deserialize)]
197pub struct PosCashMovementDeletedEvent {
198    pub id: PosCashMovementId,
199    pub occurred_at: DateTime<Utc>,
200}
201
202// ============================================================================
203// POSDISCOUNT EVENTS
204// ============================================================================
205
206/// Event published when a PosDiscount is created
207#[derive(Debug, Clone, Serialize, Deserialize)]
208pub struct PosDiscountCreatedEvent {
209    pub id: PosDiscountId,
210    pub data: PosDiscountDto,
211    pub occurred_at: DateTime<Utc>,
212}
213
214/// Event published when a PosDiscount is updated
215#[derive(Debug, Clone, Serialize, Deserialize)]
216pub struct PosDiscountUpdatedEvent {
217    pub id: PosDiscountId,
218    pub data: PosDiscountDto,
219    pub occurred_at: DateTime<Utc>,
220}
221
222/// Event published when a PosDiscount is deleted
223#[derive(Debug, Clone, Serialize, Deserialize)]
224pub struct PosDiscountDeletedEvent {
225    pub id: PosDiscountId,
226    pub occurred_at: DateTime<Utc>,
227}
228
229// ============================================================================
230// POSMANAGERPIN EVENTS
231// ============================================================================
232
233/// Event published when a PosManagerPin is created
234#[derive(Debug, Clone, Serialize, Deserialize)]
235pub struct PosManagerPinCreatedEvent {
236    pub id: PosManagerPinId,
237    pub data: PosManagerPinDto,
238    pub occurred_at: DateTime<Utc>,
239}
240
241/// Event published when a PosManagerPin is updated
242#[derive(Debug, Clone, Serialize, Deserialize)]
243pub struct PosManagerPinUpdatedEvent {
244    pub id: PosManagerPinId,
245    pub data: PosManagerPinDto,
246    pub occurred_at: DateTime<Utc>,
247}
248
249/// Event published when a PosManagerPin is deleted
250#[derive(Debug, Clone, Serialize, Deserialize)]
251pub struct PosManagerPinDeletedEvent {
252    pub id: PosManagerPinId,
253    pub occurred_at: DateTime<Utc>,
254}
255
256// ============================================================================
257// POSFLOORPLAN EVENTS
258// ============================================================================
259
260/// Event published when a PosFloorPlan is created
261#[derive(Debug, Clone, Serialize, Deserialize)]
262pub struct PosFloorPlanCreatedEvent {
263    pub id: PosFloorPlanId,
264    pub data: PosFloorPlanDto,
265    pub occurred_at: DateTime<Utc>,
266}
267
268/// Event published when a PosFloorPlan is updated
269#[derive(Debug, Clone, Serialize, Deserialize)]
270pub struct PosFloorPlanUpdatedEvent {
271    pub id: PosFloorPlanId,
272    pub data: PosFloorPlanDto,
273    pub occurred_at: DateTime<Utc>,
274}
275
276/// Event published when a PosFloorPlan is deleted
277#[derive(Debug, Clone, Serialize, Deserialize)]
278pub struct PosFloorPlanDeletedEvent {
279    pub id: PosFloorPlanId,
280    pub occurred_at: DateTime<Utc>,
281}
282
283// ============================================================================
284// POSTABLE EVENTS
285// ============================================================================
286
287/// Event published when a PosTable is created
288#[derive(Debug, Clone, Serialize, Deserialize)]
289pub struct PosTableCreatedEvent {
290    pub id: PosTableId,
291    pub data: PosTableDto,
292    pub occurred_at: DateTime<Utc>,
293}
294
295/// Event published when a PosTable is updated
296#[derive(Debug, Clone, Serialize, Deserialize)]
297pub struct PosTableUpdatedEvent {
298    pub id: PosTableId,
299    pub data: PosTableDto,
300    pub occurred_at: DateTime<Utc>,
301}
302
303/// Event published when a PosTable is deleted
304#[derive(Debug, Clone, Serialize, Deserialize)]
305pub struct PosTableDeletedEvent {
306    pub id: PosTableId,
307    pub occurred_at: DateTime<Utc>,
308}
309
310// ============================================================================
311// MODULE EVENT ENUM
312// ============================================================================
313
314/// All events published by Pos module
315#[derive(Debug, Clone, Serialize, Deserialize)]
316#[serde(tag = "type")]
317pub enum PosEvent {
318    PosClosingEntryCreated(PosClosingEntryCreatedEvent),
319    PosClosingEntryUpdated(PosClosingEntryUpdatedEvent),
320    PosClosingEntryDeleted(PosClosingEntryDeletedEvent),
321    PosInvoiceCreated(PosInvoiceCreatedEvent),
322    PosInvoiceUpdated(PosInvoiceUpdatedEvent),
323    PosInvoiceDeleted(PosInvoiceDeletedEvent),
324    PosInvoiceItemCreated(PosInvoiceItemCreatedEvent),
325    PosInvoiceItemUpdated(PosInvoiceItemUpdatedEvent),
326    PosInvoiceItemDeleted(PosInvoiceItemDeletedEvent),
327    PosPaymentCreated(PosPaymentCreatedEvent),
328    PosPaymentUpdated(PosPaymentUpdatedEvent),
329    PosPaymentDeleted(PosPaymentDeletedEvent),
330    PosProfileCreated(PosProfileCreatedEvent),
331    PosProfileUpdated(PosProfileUpdatedEvent),
332    PosProfileDeleted(PosProfileDeletedEvent),
333    PosOpeningEntryCreated(PosOpeningEntryCreatedEvent),
334    PosOpeningEntryUpdated(PosOpeningEntryUpdatedEvent),
335    PosOpeningEntryDeleted(PosOpeningEntryDeletedEvent),
336    PosCashMovementCreated(PosCashMovementCreatedEvent),
337    PosCashMovementUpdated(PosCashMovementUpdatedEvent),
338    PosCashMovementDeleted(PosCashMovementDeletedEvent),
339    PosDiscountCreated(PosDiscountCreatedEvent),
340    PosDiscountUpdated(PosDiscountUpdatedEvent),
341    PosDiscountDeleted(PosDiscountDeletedEvent),
342    PosManagerPinCreated(PosManagerPinCreatedEvent),
343    PosManagerPinUpdated(PosManagerPinUpdatedEvent),
344    PosManagerPinDeleted(PosManagerPinDeletedEvent),
345    PosFloorPlanCreated(PosFloorPlanCreatedEvent),
346    PosFloorPlanUpdated(PosFloorPlanUpdatedEvent),
347    PosFloorPlanDeleted(PosFloorPlanDeletedEvent),
348    PosTableCreated(PosTableCreatedEvent),
349    PosTableUpdated(PosTableUpdatedEvent),
350    PosTableDeleted(PosTableDeletedEvent),
351}
352
353/// Metadata for module events
354#[derive(Debug, Clone, Serialize, Deserialize)]
355pub struct PosEventMetadata {
356    pub module: &'static str,
357    pub version: &'static str,
358}
359
360impl Default for PosEventMetadata {
361    fn default() -> Self {
362        Self {
363            module: "pos",
364            version: "1.0",
365        }
366    }
367}
368
369// ============================================================================
370// CUSTOM EVENTS
371// ============================================================================
372
373// <<< CUSTOM EVENTS START >>>
374// Add custom public events here
375// <<< CUSTOM EVENTS END >>>