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 is_return: bool,
133    pub return_against: Option<Uuid>,
134    pub status: PosInvoiceStatus,
135    pub metadata: serde_json::Value,
136}
137
138/// Summary view of PosInvoice for list displays
139#[derive(Debug, Clone, Serialize, Deserialize)]
140pub struct PosInvoiceSummary {
141    pub id: PosInvoiceId,
142    pub status: PosInvoiceStatus,
143}
144
145/// Reference to PosInvoice for foreign key relationships
146#[derive(Debug, Clone, Serialize, Deserialize)]
147pub struct PosInvoiceRef {
148    pub id: PosInvoiceId,
149}
150
151// ============================================================================
152// POSINVOICEITEM TYPES
153// ============================================================================
154
155/// Type-safe ID for PosInvoiceItem
156///
157/// Use this instead of raw Uuid for type safety across modules.
158#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
159pub struct PosInvoiceItemId(pub Uuid);
160
161impl PosInvoiceItemId {
162    pub fn new(id: Uuid) -> Self {
163        Self(id)
164    }
165
166    pub fn into_inner(self) -> Uuid {
167        self.0
168    }
169}
170
171impl From<Uuid> for PosInvoiceItemId {
172    fn from(id: Uuid) -> Self {
173        Self(id)
174    }
175}
176
177impl From<PosInvoiceItemId> for Uuid {
178    fn from(id: PosInvoiceItemId) -> Self {
179        id.0
180    }
181}
182
183/// Data transfer object for PosInvoiceItem
184///
185/// This is the public representation of PosInvoiceItem for other modules.
186#[derive(Debug, Clone, Serialize, Deserialize)]
187pub struct PosInvoiceItemDto {
188    pub id: PosInvoiceItemId,
189    pub pos_invoice_id: Uuid,
190    pub item_id: Uuid,
191    pub description: Option<String>,
192    pub client_uuid: Option<Uuid>,
193    pub course: Option<i32>,
194    pub quantity: Decimal,
195    pub unit_price: Decimal,
196    pub discount_amount: Decimal,
197    pub net_amount: Decimal,
198    pub revenue_account_id: Option<Uuid>,
199    pub metadata: serde_json::Value,
200}
201
202/// Summary view of PosInvoiceItem for list displays
203#[derive(Debug, Clone, Serialize, Deserialize)]
204pub struct PosInvoiceItemSummary {
205    pub id: PosInvoiceItemId,
206}
207
208/// Reference to PosInvoiceItem for foreign key relationships
209#[derive(Debug, Clone, Serialize, Deserialize)]
210pub struct PosInvoiceItemRef {
211    pub id: PosInvoiceItemId,
212}
213
214// ============================================================================
215// POSPAYMENT TYPES
216// ============================================================================
217
218/// Type-safe ID for PosPayment
219///
220/// Use this instead of raw Uuid for type safety across modules.
221#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
222pub struct PosPaymentId(pub Uuid);
223
224impl PosPaymentId {
225    pub fn new(id: Uuid) -> Self {
226        Self(id)
227    }
228
229    pub fn into_inner(self) -> Uuid {
230        self.0
231    }
232}
233
234impl From<Uuid> for PosPaymentId {
235    fn from(id: Uuid) -> Self {
236        Self(id)
237    }
238}
239
240impl From<PosPaymentId> for Uuid {
241    fn from(id: PosPaymentId) -> Self {
242        id.0
243    }
244}
245
246/// Data transfer object for PosPayment
247///
248/// This is the public representation of PosPayment for other modules.
249#[derive(Debug, Clone, Serialize, Deserialize)]
250pub struct PosPaymentDto {
251    pub id: PosPaymentId,
252    pub pos_invoice_id: Uuid,
253    pub payment_method: PosPaymentMethod,
254    pub amount: Decimal,
255    pub reference_no: Option<String>,
256    pub client_uuid: Option<Uuid>,
257    pub payment_entry_id: Option<Uuid>,
258    pub metadata: serde_json::Value,
259}
260
261/// Summary view of PosPayment for list displays
262#[derive(Debug, Clone, Serialize, Deserialize)]
263pub struct PosPaymentSummary {
264    pub id: PosPaymentId,
265}
266
267/// Reference to PosPayment for foreign key relationships
268#[derive(Debug, Clone, Serialize, Deserialize)]
269pub struct PosPaymentRef {
270    pub id: PosPaymentId,
271}
272
273// ============================================================================
274// POSPROFILE TYPES
275// ============================================================================
276
277/// Type-safe ID for PosProfile
278///
279/// Use this instead of raw Uuid for type safety across modules.
280#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
281pub struct PosProfileId(pub Uuid);
282
283impl PosProfileId {
284    pub fn new(id: Uuid) -> Self {
285        Self(id)
286    }
287
288    pub fn into_inner(self) -> Uuid {
289        self.0
290    }
291}
292
293impl From<Uuid> for PosProfileId {
294    fn from(id: Uuid) -> Self {
295        Self(id)
296    }
297}
298
299impl From<PosProfileId> for Uuid {
300    fn from(id: PosProfileId) -> Self {
301        id.0
302    }
303}
304
305/// Data transfer object for PosProfile
306///
307/// This is the public representation of PosProfile for other modules.
308#[derive(Debug, Clone, Serialize, Deserialize)]
309pub struct PosProfileDto {
310    pub id: PosProfileId,
311    pub branch_id: Option<Uuid>,
312    pub name: String,
313    pub default_customer_id: Option<Uuid>,
314    pub currency: String,
315    pub income_account_id: Option<Uuid>,
316    pub receivable_account_id: Option<Uuid>,
317    pub cash_account_id: Option<Uuid>,
318    pub write_off_account_id: Option<Uuid>,
319    pub tax_account_id: Option<Uuid>,
320    pub tax_rate: Decimal,
321    pub tax_template_ids: Option<serde_json::Value>,
322    pub warehouse_id: Option<Uuid>,
323    pub cogs_account_id: Option<Uuid>,
324    pub inventory_account_id: Option<Uuid>,
325    pub allow_discount: bool,
326    pub cash_rounding_strategy: PosCashRoundingStrategy,
327    pub cash_rounding_unit: Decimal,
328    pub status: PosProfileStatus,
329    pub metadata: serde_json::Value,
330}
331
332/// Summary view of PosProfile for list displays
333#[derive(Debug, Clone, Serialize, Deserialize)]
334pub struct PosProfileSummary {
335    pub id: PosProfileId,
336    pub name: String,
337    pub status: PosProfileStatus,
338}
339
340/// Reference to PosProfile for foreign key relationships
341#[derive(Debug, Clone, Serialize, Deserialize)]
342pub struct PosProfileRef {
343    pub id: PosProfileId,
344}
345
346// ============================================================================
347// POSOPENINGENTRY TYPES
348// ============================================================================
349
350/// Type-safe ID for PosOpeningEntry
351///
352/// Use this instead of raw Uuid for type safety across modules.
353#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
354pub struct PosOpeningEntryId(pub Uuid);
355
356impl PosOpeningEntryId {
357    pub fn new(id: Uuid) -> Self {
358        Self(id)
359    }
360
361    pub fn into_inner(self) -> Uuid {
362        self.0
363    }
364}
365
366impl From<Uuid> for PosOpeningEntryId {
367    fn from(id: Uuid) -> Self {
368        Self(id)
369    }
370}
371
372impl From<PosOpeningEntryId> for Uuid {
373    fn from(id: PosOpeningEntryId) -> Self {
374        id.0
375    }
376}
377
378/// Data transfer object for PosOpeningEntry
379///
380/// This is the public representation of PosOpeningEntry for other modules.
381#[derive(Debug, Clone, Serialize, Deserialize)]
382pub struct PosOpeningEntryDto {
383    pub id: PosOpeningEntryId,
384    pub pos_profile_id: Uuid,
385    pub branch_id: Option<Uuid>,
386    pub cashier_party_id: Uuid,
387    pub opened_at: DateTime<Utc>,
388    pub opening_balances: Option<serde_json::Value>,
389    pub status: PosSessionStatus,
390    pub metadata: serde_json::Value,
391}
392
393/// Summary view of PosOpeningEntry for list displays
394#[derive(Debug, Clone, Serialize, Deserialize)]
395pub struct PosOpeningEntrySummary {
396    pub id: PosOpeningEntryId,
397    pub status: PosSessionStatus,
398}
399
400/// Reference to PosOpeningEntry for foreign key relationships
401#[derive(Debug, Clone, Serialize, Deserialize)]
402pub struct PosOpeningEntryRef {
403    pub id: PosOpeningEntryId,
404}
405
406// ============================================================================
407// POSCASHMOVEMENT TYPES
408// ============================================================================
409
410/// Type-safe ID for PosCashMovement
411///
412/// Use this instead of raw Uuid for type safety across modules.
413#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
414pub struct PosCashMovementId(pub Uuid);
415
416impl PosCashMovementId {
417    pub fn new(id: Uuid) -> Self {
418        Self(id)
419    }
420
421    pub fn into_inner(self) -> Uuid {
422        self.0
423    }
424}
425
426impl From<Uuid> for PosCashMovementId {
427    fn from(id: Uuid) -> Self {
428        Self(id)
429    }
430}
431
432impl From<PosCashMovementId> for Uuid {
433    fn from(id: PosCashMovementId) -> Self {
434        id.0
435    }
436}
437
438/// Data transfer object for PosCashMovement
439///
440/// This is the public representation of PosCashMovement for other modules.
441#[derive(Debug, Clone, Serialize, Deserialize)]
442pub struct PosCashMovementDto {
443    pub id: PosCashMovementId,
444    pub pos_profile_id: Uuid,
445    pub opening_entry_id: Uuid,
446    pub cashier_party_id: Uuid,
447    pub movement_type: PosCashMovementType,
448    pub amount: Decimal,
449    pub reason: Option<String>,
450    pub moved_at: DateTime<Utc>,
451    pub metadata: serde_json::Value,
452}
453
454/// Summary view of PosCashMovement for list displays
455#[derive(Debug, Clone, Serialize, Deserialize)]
456pub struct PosCashMovementSummary {
457    pub id: PosCashMovementId,
458}
459
460/// Reference to PosCashMovement for foreign key relationships
461#[derive(Debug, Clone, Serialize, Deserialize)]
462pub struct PosCashMovementRef {
463    pub id: PosCashMovementId,
464}
465
466// ============================================================================
467// POSDISCOUNT TYPES
468// ============================================================================
469
470/// Type-safe ID for PosDiscount
471///
472/// Use this instead of raw Uuid for type safety across modules.
473#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
474pub struct PosDiscountId(pub Uuid);
475
476impl PosDiscountId {
477    pub fn new(id: Uuid) -> Self {
478        Self(id)
479    }
480
481    pub fn into_inner(self) -> Uuid {
482        self.0
483    }
484}
485
486impl From<Uuid> for PosDiscountId {
487    fn from(id: Uuid) -> Self {
488        Self(id)
489    }
490}
491
492impl From<PosDiscountId> for Uuid {
493    fn from(id: PosDiscountId) -> Self {
494        id.0
495    }
496}
497
498/// Data transfer object for PosDiscount
499///
500/// This is the public representation of PosDiscount for other modules.
501#[derive(Debug, Clone, Serialize, Deserialize)]
502pub struct PosDiscountDto {
503    pub id: PosDiscountId,
504    pub name: String,
505    pub percentage: Decimal,
506    pub description: Option<String>,
507    pub metadata: serde_json::Value,
508}
509
510/// Summary view of PosDiscount for list displays
511#[derive(Debug, Clone, Serialize, Deserialize)]
512pub struct PosDiscountSummary {
513    pub id: PosDiscountId,
514    pub name: String,
515}
516
517/// Reference to PosDiscount for foreign key relationships
518#[derive(Debug, Clone, Serialize, Deserialize)]
519pub struct PosDiscountRef {
520    pub id: PosDiscountId,
521}
522
523// ============================================================================
524// POSMANAGERPIN TYPES
525// ============================================================================
526
527/// Type-safe ID for PosManagerPin
528///
529/// Use this instead of raw Uuid for type safety across modules.
530#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
531pub struct PosManagerPinId(pub Uuid);
532
533impl PosManagerPinId {
534    pub fn new(id: Uuid) -> Self {
535        Self(id)
536    }
537
538    pub fn into_inner(self) -> Uuid {
539        self.0
540    }
541}
542
543impl From<Uuid> for PosManagerPinId {
544    fn from(id: Uuid) -> Self {
545        Self(id)
546    }
547}
548
549impl From<PosManagerPinId> for Uuid {
550    fn from(id: PosManagerPinId) -> Self {
551        id.0
552    }
553}
554
555/// Data transfer object for PosManagerPin
556///
557/// This is the public representation of PosManagerPin for other modules.
558#[derive(Debug, Clone, Serialize, Deserialize)]
559pub struct PosManagerPinDto {
560    pub id: PosManagerPinId,
561    pub employee_party_id: Uuid,
562    pub pin_hash: String,
563    pub failed_attempts: i32,
564    pub locked_until: Option<DateTime<Utc>>,
565    pub last_attempt_at: Option<DateTime<Utc>>,
566    pub last_attempt_ip: Option<String>,
567    pub metadata: serde_json::Value,
568}
569
570/// Summary view of PosManagerPin for list displays
571#[derive(Debug, Clone, Serialize, Deserialize)]
572pub struct PosManagerPinSummary {
573    pub id: PosManagerPinId,
574}
575
576/// Reference to PosManagerPin for foreign key relationships
577#[derive(Debug, Clone, Serialize, Deserialize)]
578pub struct PosManagerPinRef {
579    pub id: PosManagerPinId,
580}
581
582// ============================================================================
583// POSFLOORPLAN TYPES
584// ============================================================================
585
586/// Type-safe ID for PosFloorPlan
587///
588/// Use this instead of raw Uuid for type safety across modules.
589#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
590pub struct PosFloorPlanId(pub Uuid);
591
592impl PosFloorPlanId {
593    pub fn new(id: Uuid) -> Self {
594        Self(id)
595    }
596
597    pub fn into_inner(self) -> Uuid {
598        self.0
599    }
600}
601
602impl From<Uuid> for PosFloorPlanId {
603    fn from(id: Uuid) -> Self {
604        Self(id)
605    }
606}
607
608impl From<PosFloorPlanId> for Uuid {
609    fn from(id: PosFloorPlanId) -> Self {
610        id.0
611    }
612}
613
614/// Data transfer object for PosFloorPlan
615///
616/// This is the public representation of PosFloorPlan for other modules.
617#[derive(Debug, Clone, Serialize, Deserialize)]
618pub struct PosFloorPlanDto {
619    pub id: PosFloorPlanId,
620    pub branch_id: Option<Uuid>,
621    pub name: String,
622    pub position: Option<i32>,
623    pub metadata: serde_json::Value,
624}
625
626/// Summary view of PosFloorPlan for list displays
627#[derive(Debug, Clone, Serialize, Deserialize)]
628pub struct PosFloorPlanSummary {
629    pub id: PosFloorPlanId,
630    pub name: String,
631}
632
633/// Reference to PosFloorPlan for foreign key relationships
634#[derive(Debug, Clone, Serialize, Deserialize)]
635pub struct PosFloorPlanRef {
636    pub id: PosFloorPlanId,
637}
638
639// ============================================================================
640// POSTABLE TYPES
641// ============================================================================
642
643/// Type-safe ID for PosTable
644///
645/// Use this instead of raw Uuid for type safety across modules.
646#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
647pub struct PosTableId(pub Uuid);
648
649impl PosTableId {
650    pub fn new(id: Uuid) -> Self {
651        Self(id)
652    }
653
654    pub fn into_inner(self) -> Uuid {
655        self.0
656    }
657}
658
659impl From<Uuid> for PosTableId {
660    fn from(id: Uuid) -> Self {
661        Self(id)
662    }
663}
664
665impl From<PosTableId> for Uuid {
666    fn from(id: PosTableId) -> Self {
667        id.0
668    }
669}
670
671/// Data transfer object for PosTable
672///
673/// This is the public representation of PosTable for other modules.
674#[derive(Debug, Clone, Serialize, Deserialize)]
675pub struct PosTableDto {
676    pub id: PosTableId,
677    pub pos_floor_plan_id: Uuid,
678    pub name: Option<String>,
679    pub seats: Option<i32>,
680    pub shape: Option<String>,
681    pub position: Option<serde_json::Value>,
682    pub metadata: serde_json::Value,
683}
684
685/// Summary view of PosTable for list displays
686#[derive(Debug, Clone, Serialize, Deserialize)]
687pub struct PosTableSummary {
688    pub id: PosTableId,
689    pub name: Option<String>,
690}
691
692/// Reference to PosTable for foreign key relationships
693#[derive(Debug, Clone, Serialize, Deserialize)]
694pub struct PosTableRef {
695    pub id: PosTableId,
696}
697
698// ============================================================================
699// CUSTOM TYPES
700// ============================================================================
701
702// <<< CUSTOM TYPES START >>>
703// Add custom public types here
704// <<< CUSTOM TYPES END >>>