Skip to main content

backbone_pos/exports/
types.rs

1//! Public types for Pos module
2//!
3//! Generated by metaphor-schema. Do not edit manually.
4//!
5//! These DTOs are the ONLY types other modules should use.
6//! They are decoupled from internal domain entities.
7
8use serde::{Deserialize, Serialize};
9use uuid::Uuid;
10use chrono::{DateTime, Utc};
11use rust_decimal::Decimal;
12use crate::domain::entity::*;
13
14// ============================================================================
15// POSCLOSINGENTRY TYPES
16// ============================================================================
17
18/// Type-safe ID for PosClosingEntry
19///
20/// Use this instead of raw Uuid for type safety across modules.
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
22pub struct PosClosingEntryId(pub Uuid);
23
24impl PosClosingEntryId {
25    pub fn new(id: Uuid) -> Self {
26        Self(id)
27    }
28
29    pub fn into_inner(self) -> Uuid {
30        self.0
31    }
32}
33
34impl From<Uuid> for PosClosingEntryId {
35    fn from(id: Uuid) -> Self {
36        Self(id)
37    }
38}
39
40impl From<PosClosingEntryId> for Uuid {
41    fn from(id: PosClosingEntryId) -> Self {
42        id.0
43    }
44}
45
46/// Data transfer object for PosClosingEntry
47///
48/// This is the public representation of PosClosingEntry for other modules.
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct PosClosingEntryDto {
51    pub id: PosClosingEntryId,
52    pub pos_profile_id: Uuid,
53    pub opening_entry_id: Uuid,
54    pub closed_at: DateTime<Utc>,
55    pub cashier_party_id: Uuid,
56    pub totals_by_method: Option<serde_json::Value>,
57    pub grand_total: Decimal,
58    pub invoice_count: i32,
59    pub difference_total: Decimal,
60    pub status: PosClosingStatus,
61    pub metadata: serde_json::Value,
62}
63
64/// Summary view of PosClosingEntry for list displays
65#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct PosClosingEntrySummary {
67    pub id: PosClosingEntryId,
68    pub status: PosClosingStatus,
69}
70
71/// Reference to PosClosingEntry for foreign key relationships
72#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct PosClosingEntryRef {
74    pub id: PosClosingEntryId,
75}
76
77// ============================================================================
78// POSINVOICE TYPES
79// ============================================================================
80
81/// Type-safe ID for PosInvoice
82///
83/// Use this instead of raw Uuid for type safety across modules.
84#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
85pub struct PosInvoiceId(pub Uuid);
86
87impl PosInvoiceId {
88    pub fn new(id: Uuid) -> Self {
89        Self(id)
90    }
91
92    pub fn into_inner(self) -> Uuid {
93        self.0
94    }
95}
96
97impl From<Uuid> for PosInvoiceId {
98    fn from(id: Uuid) -> Self {
99        Self(id)
100    }
101}
102
103impl From<PosInvoiceId> for Uuid {
104    fn from(id: PosInvoiceId) -> Self {
105        id.0
106    }
107}
108
109/// Data transfer object for PosInvoice
110///
111/// This is the public representation of PosInvoice for other modules.
112#[derive(Debug, Clone, Serialize, Deserialize)]
113pub struct PosInvoiceDto {
114    pub id: PosInvoiceId,
115    pub pos_profile_id: Uuid,
116    pub opening_entry_id: Uuid,
117    pub branch_id: Option<Uuid>,
118    pub customer_id: Option<Uuid>,
119    pub pos_table_id: Option<Uuid>,
120    pub receipt_number: String,
121    pub client_uuid: Option<Uuid>,
122    pub posting_at: DateTime<Utc>,
123    pub net_total: Decimal,
124    pub tax_total: Decimal,
125    pub grand_total: Decimal,
126    pub rounding_adjustment: Decimal,
127    pub rounded_total: Decimal,
128    pub paid_total: Decimal,
129    pub change_due: Decimal,
130    pub billing_invoice_id: Option<Uuid>,
131    pub payment_entry_id: Option<Uuid>,
132    pub stock_delivery_note_id: Option<Uuid>,
133    pub is_return: bool,
134    pub return_against: Option<Uuid>,
135    pub status: PosInvoiceStatus,
136    pub metadata: serde_json::Value,
137}
138
139/// Summary view of PosInvoice for list displays
140#[derive(Debug, Clone, Serialize, Deserialize)]
141pub struct PosInvoiceSummary {
142    pub id: PosInvoiceId,
143    pub status: PosInvoiceStatus,
144}
145
146/// Reference to PosInvoice for foreign key relationships
147#[derive(Debug, Clone, Serialize, Deserialize)]
148pub struct PosInvoiceRef {
149    pub id: PosInvoiceId,
150}
151
152// ============================================================================
153// POSINVOICEITEM TYPES
154// ============================================================================
155
156/// Type-safe ID for PosInvoiceItem
157///
158/// Use this instead of raw Uuid for type safety across modules.
159#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
160pub struct PosInvoiceItemId(pub Uuid);
161
162impl PosInvoiceItemId {
163    pub fn new(id: Uuid) -> Self {
164        Self(id)
165    }
166
167    pub fn into_inner(self) -> Uuid {
168        self.0
169    }
170}
171
172impl From<Uuid> for PosInvoiceItemId {
173    fn from(id: Uuid) -> Self {
174        Self(id)
175    }
176}
177
178impl From<PosInvoiceItemId> for Uuid {
179    fn from(id: PosInvoiceItemId) -> Self {
180        id.0
181    }
182}
183
184/// Data transfer object for PosInvoiceItem
185///
186/// This is the public representation of PosInvoiceItem for other modules.
187#[derive(Debug, Clone, Serialize, Deserialize)]
188pub struct PosInvoiceItemDto {
189    pub id: PosInvoiceItemId,
190    pub pos_invoice_id: Uuid,
191    pub item_id: Uuid,
192    pub description: Option<String>,
193    pub client_uuid: Option<Uuid>,
194    pub course: Option<i32>,
195    pub quantity: Decimal,
196    pub unit_price: Decimal,
197    pub discount_amount: Decimal,
198    pub net_amount: Decimal,
199    pub revenue_account_id: Option<Uuid>,
200    pub metadata: serde_json::Value,
201}
202
203/// Summary view of PosInvoiceItem for list displays
204#[derive(Debug, Clone, Serialize, Deserialize)]
205pub struct PosInvoiceItemSummary {
206    pub id: PosInvoiceItemId,
207}
208
209/// Reference to PosInvoiceItem for foreign key relationships
210#[derive(Debug, Clone, Serialize, Deserialize)]
211pub struct PosInvoiceItemRef {
212    pub id: PosInvoiceItemId,
213}
214
215// ============================================================================
216// POSPAYMENT TYPES
217// ============================================================================
218
219/// Type-safe ID for PosPayment
220///
221/// Use this instead of raw Uuid for type safety across modules.
222#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
223pub struct PosPaymentId(pub Uuid);
224
225impl PosPaymentId {
226    pub fn new(id: Uuid) -> Self {
227        Self(id)
228    }
229
230    pub fn into_inner(self) -> Uuid {
231        self.0
232    }
233}
234
235impl From<Uuid> for PosPaymentId {
236    fn from(id: Uuid) -> Self {
237        Self(id)
238    }
239}
240
241impl From<PosPaymentId> for Uuid {
242    fn from(id: PosPaymentId) -> Self {
243        id.0
244    }
245}
246
247/// Data transfer object for PosPayment
248///
249/// This is the public representation of PosPayment for other modules.
250#[derive(Debug, Clone, Serialize, Deserialize)]
251pub struct PosPaymentDto {
252    pub id: PosPaymentId,
253    pub pos_invoice_id: Uuid,
254    pub payment_method: PosPaymentMethod,
255    pub amount: Decimal,
256    pub reference_no: Option<String>,
257    pub client_uuid: Option<Uuid>,
258    pub payment_entry_id: Option<Uuid>,
259    pub metadata: serde_json::Value,
260}
261
262/// Summary view of PosPayment for list displays
263#[derive(Debug, Clone, Serialize, Deserialize)]
264pub struct PosPaymentSummary {
265    pub id: PosPaymentId,
266}
267
268/// Reference to PosPayment for foreign key relationships
269#[derive(Debug, Clone, Serialize, Deserialize)]
270pub struct PosPaymentRef {
271    pub id: PosPaymentId,
272}
273
274// ============================================================================
275// POSPROFILE TYPES
276// ============================================================================
277
278/// Type-safe ID for PosProfile
279///
280/// Use this instead of raw Uuid for type safety across modules.
281#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
282pub struct PosProfileId(pub Uuid);
283
284impl PosProfileId {
285    pub fn new(id: Uuid) -> Self {
286        Self(id)
287    }
288
289    pub fn into_inner(self) -> Uuid {
290        self.0
291    }
292}
293
294impl From<Uuid> for PosProfileId {
295    fn from(id: Uuid) -> Self {
296        Self(id)
297    }
298}
299
300impl From<PosProfileId> for Uuid {
301    fn from(id: PosProfileId) -> Self {
302        id.0
303    }
304}
305
306/// Data transfer object for PosProfile
307///
308/// This is the public representation of PosProfile for other modules.
309#[derive(Debug, Clone, Serialize, Deserialize)]
310pub struct PosProfileDto {
311    pub id: PosProfileId,
312    pub branch_id: Option<Uuid>,
313    pub name: String,
314    pub default_customer_id: Option<Uuid>,
315    pub currency: String,
316    pub income_account_id: Option<Uuid>,
317    pub receivable_account_id: Option<Uuid>,
318    pub cash_account_id: Option<Uuid>,
319    pub write_off_account_id: Option<Uuid>,
320    pub tax_account_id: Option<Uuid>,
321    pub tax_rate: Decimal,
322    pub tax_template_ids: Option<serde_json::Value>,
323    pub warehouse_id: Option<Uuid>,
324    pub cogs_account_id: Option<Uuid>,
325    pub inventory_account_id: Option<Uuid>,
326    pub allow_discount: bool,
327    pub cash_rounding_strategy: PosCashRoundingStrategy,
328    pub cash_rounding_unit: Decimal,
329    pub status: PosProfileStatus,
330    pub metadata: serde_json::Value,
331}
332
333/// Summary view of PosProfile for list displays
334#[derive(Debug, Clone, Serialize, Deserialize)]
335pub struct PosProfileSummary {
336    pub id: PosProfileId,
337    pub name: String,
338    pub status: PosProfileStatus,
339}
340
341/// Reference to PosProfile for foreign key relationships
342#[derive(Debug, Clone, Serialize, Deserialize)]
343pub struct PosProfileRef {
344    pub id: PosProfileId,
345}
346
347// ============================================================================
348// POSOPENINGENTRY TYPES
349// ============================================================================
350
351/// Type-safe ID for PosOpeningEntry
352///
353/// Use this instead of raw Uuid for type safety across modules.
354#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
355pub struct PosOpeningEntryId(pub Uuid);
356
357impl PosOpeningEntryId {
358    pub fn new(id: Uuid) -> Self {
359        Self(id)
360    }
361
362    pub fn into_inner(self) -> Uuid {
363        self.0
364    }
365}
366
367impl From<Uuid> for PosOpeningEntryId {
368    fn from(id: Uuid) -> Self {
369        Self(id)
370    }
371}
372
373impl From<PosOpeningEntryId> for Uuid {
374    fn from(id: PosOpeningEntryId) -> Self {
375        id.0
376    }
377}
378
379/// Data transfer object for PosOpeningEntry
380///
381/// This is the public representation of PosOpeningEntry for other modules.
382#[derive(Debug, Clone, Serialize, Deserialize)]
383pub struct PosOpeningEntryDto {
384    pub id: PosOpeningEntryId,
385    pub pos_profile_id: Uuid,
386    pub branch_id: Option<Uuid>,
387    pub cashier_party_id: Uuid,
388    pub opened_at: DateTime<Utc>,
389    pub opening_balances: Option<serde_json::Value>,
390    pub status: PosSessionStatus,
391    pub metadata: serde_json::Value,
392}
393
394/// Summary view of PosOpeningEntry for list displays
395#[derive(Debug, Clone, Serialize, Deserialize)]
396pub struct PosOpeningEntrySummary {
397    pub id: PosOpeningEntryId,
398    pub status: PosSessionStatus,
399}
400
401/// Reference to PosOpeningEntry for foreign key relationships
402#[derive(Debug, Clone, Serialize, Deserialize)]
403pub struct PosOpeningEntryRef {
404    pub id: PosOpeningEntryId,
405}
406
407// ============================================================================
408// POSCASHMOVEMENT TYPES
409// ============================================================================
410
411/// Type-safe ID for PosCashMovement
412///
413/// Use this instead of raw Uuid for type safety across modules.
414#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
415pub struct PosCashMovementId(pub Uuid);
416
417impl PosCashMovementId {
418    pub fn new(id: Uuid) -> Self {
419        Self(id)
420    }
421
422    pub fn into_inner(self) -> Uuid {
423        self.0
424    }
425}
426
427impl From<Uuid> for PosCashMovementId {
428    fn from(id: Uuid) -> Self {
429        Self(id)
430    }
431}
432
433impl From<PosCashMovementId> for Uuid {
434    fn from(id: PosCashMovementId) -> Self {
435        id.0
436    }
437}
438
439/// Data transfer object for PosCashMovement
440///
441/// This is the public representation of PosCashMovement for other modules.
442#[derive(Debug, Clone, Serialize, Deserialize)]
443pub struct PosCashMovementDto {
444    pub id: PosCashMovementId,
445    pub pos_profile_id: Uuid,
446    pub opening_entry_id: Uuid,
447    pub cashier_party_id: Uuid,
448    pub movement_type: PosCashMovementType,
449    pub amount: Decimal,
450    pub reason: Option<String>,
451    pub moved_at: DateTime<Utc>,
452    pub metadata: serde_json::Value,
453}
454
455/// Summary view of PosCashMovement for list displays
456#[derive(Debug, Clone, Serialize, Deserialize)]
457pub struct PosCashMovementSummary {
458    pub id: PosCashMovementId,
459}
460
461/// Reference to PosCashMovement for foreign key relationships
462#[derive(Debug, Clone, Serialize, Deserialize)]
463pub struct PosCashMovementRef {
464    pub id: PosCashMovementId,
465}
466
467// ============================================================================
468// POSDISCOUNT TYPES
469// ============================================================================
470
471/// Type-safe ID for PosDiscount
472///
473/// Use this instead of raw Uuid for type safety across modules.
474#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
475pub struct PosDiscountId(pub Uuid);
476
477impl PosDiscountId {
478    pub fn new(id: Uuid) -> Self {
479        Self(id)
480    }
481
482    pub fn into_inner(self) -> Uuid {
483        self.0
484    }
485}
486
487impl From<Uuid> for PosDiscountId {
488    fn from(id: Uuid) -> Self {
489        Self(id)
490    }
491}
492
493impl From<PosDiscountId> for Uuid {
494    fn from(id: PosDiscountId) -> Self {
495        id.0
496    }
497}
498
499/// Data transfer object for PosDiscount
500///
501/// This is the public representation of PosDiscount for other modules.
502#[derive(Debug, Clone, Serialize, Deserialize)]
503pub struct PosDiscountDto {
504    pub id: PosDiscountId,
505    pub name: String,
506    pub percentage: Decimal,
507    pub description: Option<String>,
508    pub metadata: serde_json::Value,
509}
510
511/// Summary view of PosDiscount for list displays
512#[derive(Debug, Clone, Serialize, Deserialize)]
513pub struct PosDiscountSummary {
514    pub id: PosDiscountId,
515    pub name: String,
516}
517
518/// Reference to PosDiscount for foreign key relationships
519#[derive(Debug, Clone, Serialize, Deserialize)]
520pub struct PosDiscountRef {
521    pub id: PosDiscountId,
522}
523
524// ============================================================================
525// POSMANAGERPIN TYPES
526// ============================================================================
527
528/// Type-safe ID for PosManagerPin
529///
530/// Use this instead of raw Uuid for type safety across modules.
531#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
532pub struct PosManagerPinId(pub Uuid);
533
534impl PosManagerPinId {
535    pub fn new(id: Uuid) -> Self {
536        Self(id)
537    }
538
539    pub fn into_inner(self) -> Uuid {
540        self.0
541    }
542}
543
544impl From<Uuid> for PosManagerPinId {
545    fn from(id: Uuid) -> Self {
546        Self(id)
547    }
548}
549
550impl From<PosManagerPinId> for Uuid {
551    fn from(id: PosManagerPinId) -> Self {
552        id.0
553    }
554}
555
556/// Data transfer object for PosManagerPin
557///
558/// This is the public representation of PosManagerPin for other modules.
559#[derive(Debug, Clone, Serialize, Deserialize)]
560pub struct PosManagerPinDto {
561    pub id: PosManagerPinId,
562    pub employee_party_id: Uuid,
563    pub pin_hash: String,
564    pub failed_attempts: i32,
565    pub locked_until: Option<DateTime<Utc>>,
566    pub last_attempt_at: Option<DateTime<Utc>>,
567    pub last_attempt_ip: Option<String>,
568    pub metadata: serde_json::Value,
569}
570
571/// Summary view of PosManagerPin for list displays
572#[derive(Debug, Clone, Serialize, Deserialize)]
573pub struct PosManagerPinSummary {
574    pub id: PosManagerPinId,
575}
576
577/// Reference to PosManagerPin for foreign key relationships
578#[derive(Debug, Clone, Serialize, Deserialize)]
579pub struct PosManagerPinRef {
580    pub id: PosManagerPinId,
581}
582
583// ============================================================================
584// POSFLOORPLAN TYPES
585// ============================================================================
586
587/// Type-safe ID for PosFloorPlan
588///
589/// Use this instead of raw Uuid for type safety across modules.
590#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
591pub struct PosFloorPlanId(pub Uuid);
592
593impl PosFloorPlanId {
594    pub fn new(id: Uuid) -> Self {
595        Self(id)
596    }
597
598    pub fn into_inner(self) -> Uuid {
599        self.0
600    }
601}
602
603impl From<Uuid> for PosFloorPlanId {
604    fn from(id: Uuid) -> Self {
605        Self(id)
606    }
607}
608
609impl From<PosFloorPlanId> for Uuid {
610    fn from(id: PosFloorPlanId) -> Self {
611        id.0
612    }
613}
614
615/// Data transfer object for PosFloorPlan
616///
617/// This is the public representation of PosFloorPlan for other modules.
618#[derive(Debug, Clone, Serialize, Deserialize)]
619pub struct PosFloorPlanDto {
620    pub id: PosFloorPlanId,
621    pub branch_id: Option<Uuid>,
622    pub name: String,
623    pub position: Option<i32>,
624    pub metadata: serde_json::Value,
625}
626
627/// Summary view of PosFloorPlan for list displays
628#[derive(Debug, Clone, Serialize, Deserialize)]
629pub struct PosFloorPlanSummary {
630    pub id: PosFloorPlanId,
631    pub name: String,
632}
633
634/// Reference to PosFloorPlan for foreign key relationships
635#[derive(Debug, Clone, Serialize, Deserialize)]
636pub struct PosFloorPlanRef {
637    pub id: PosFloorPlanId,
638}
639
640// ============================================================================
641// POSTABLE TYPES
642// ============================================================================
643
644/// Type-safe ID for PosTable
645///
646/// Use this instead of raw Uuid for type safety across modules.
647#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
648pub struct PosTableId(pub Uuid);
649
650impl PosTableId {
651    pub fn new(id: Uuid) -> Self {
652        Self(id)
653    }
654
655    pub fn into_inner(self) -> Uuid {
656        self.0
657    }
658}
659
660impl From<Uuid> for PosTableId {
661    fn from(id: Uuid) -> Self {
662        Self(id)
663    }
664}
665
666impl From<PosTableId> for Uuid {
667    fn from(id: PosTableId) -> Self {
668        id.0
669    }
670}
671
672/// Data transfer object for PosTable
673///
674/// This is the public representation of PosTable for other modules.
675#[derive(Debug, Clone, Serialize, Deserialize)]
676pub struct PosTableDto {
677    pub id: PosTableId,
678    pub pos_floor_plan_id: Uuid,
679    pub name: Option<String>,
680    pub seats: Option<i32>,
681    pub shape: Option<String>,
682    pub position: Option<serde_json::Value>,
683    pub metadata: serde_json::Value,
684}
685
686/// Summary view of PosTable for list displays
687#[derive(Debug, Clone, Serialize, Deserialize)]
688pub struct PosTableSummary {
689    pub id: PosTableId,
690    pub name: Option<String>,
691}
692
693/// Reference to PosTable for foreign key relationships
694#[derive(Debug, Clone, Serialize, Deserialize)]
695pub struct PosTableRef {
696    pub id: PosTableId,
697}
698
699// ============================================================================
700// CUSTOM TYPES
701// ============================================================================
702
703// Add custom public types here