Skip to main content

backbone_accounting/exports/
types.rs

1//! Public types for Accounting 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, NaiveDate};
11use rust_decimal::Decimal;
12use crate::domain::entity::*;
13
14// ============================================================================
15// ACCOUNT TYPES
16// ============================================================================
17
18/// Type-safe ID for Account
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 AccountId(pub Uuid);
23
24impl AccountId {
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 AccountId {
35    fn from(id: Uuid) -> Self {
36        Self(id)
37    }
38}
39
40impl From<AccountId> for Uuid {
41    fn from(id: AccountId) -> Self {
42        id.0
43    }
44}
45
46/// Data transfer object for Account
47///
48/// This is the public representation of Account for other modules.
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct AccountDto {
51    pub id: AccountId,
52    pub account_number: String,
53    pub account_code: String,
54    pub name: String,
55    pub description: Option<String>,
56    pub account_type: AccountType,
57    pub account_subtype: AccountSubtype,
58    pub normal_balance: NormalBalance,
59    pub parent_id: Option<Uuid>,
60    pub level: i32,
61    pub path: Option<String>,
62    pub is_header: bool,
63    pub is_detail: bool,
64    pub currency: String,
65    pub opening_balance: Decimal,
66    pub opening_balance_date: Option<NaiveDate>,
67    pub current_balance: Decimal,
68    pub is_reconcilable: bool,
69    pub has_budget: bool,
70    pub budget_amount: Option<Decimal>,
71    pub sort_order: i32,
72    pub show_in_reports: bool,
73    pub status: AccountStatus,
74    pub is_system: bool,
75    pub notes: Option<String>,
76    pub source_id: Option<Uuid>,
77    pub is_cloned: bool,
78    pub chart_code: Option<String>,
79    pub chart_version: Option<String>,
80    pub metadata: serde_json::Value,
81}
82
83/// Summary view of Account for list displays
84#[derive(Debug, Clone, Serialize, Deserialize)]
85pub struct AccountSummary {
86    pub id: AccountId,
87    pub name: String,
88    pub status: AccountStatus,
89}
90
91/// Reference to Account for foreign key relationships
92#[derive(Debug, Clone, Serialize, Deserialize)]
93pub struct AccountRef {
94    pub id: AccountId,
95}
96
97// ============================================================================
98// ACCOUNTINGPOST TYPES
99// ============================================================================
100
101/// Type-safe ID for AccountingPost
102///
103/// Use this instead of raw Uuid for type safety across modules.
104#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
105pub struct AccountingPostId(pub Uuid);
106
107impl AccountingPostId {
108    pub fn new(id: Uuid) -> Self {
109        Self(id)
110    }
111
112    pub fn into_inner(self) -> Uuid {
113        self.0
114    }
115}
116
117impl From<Uuid> for AccountingPostId {
118    fn from(id: Uuid) -> Self {
119        Self(id)
120    }
121}
122
123impl From<AccountingPostId> for Uuid {
124    fn from(id: AccountingPostId) -> Self {
125        id.0
126    }
127}
128
129/// Data transfer object for AccountingPost
130///
131/// This is the public representation of AccountingPost for other modules.
132#[derive(Debug, Clone, Serialize, Deserialize)]
133pub struct AccountingPostDto {
134    pub id: AccountingPostId,
135    pub branch_id: Option<Uuid>,
136    pub source_type: PostingSourceType,
137    pub source_id: Uuid,
138    pub source_reference: Option<String>,
139    pub journal_id: Option<Uuid>,
140    pub posting_type: PostingType,
141    pub posting_status: PostingStatus,
142    pub currency: String,
143    pub total_debit: Decimal,
144    pub total_credit: Decimal,
145    pub scheduled_at: Option<DateTime<Utc>>,
146    pub posted_at: Option<DateTime<Utc>>,
147    pub failed_at: Option<DateTime<Utc>>,
148    pub retry_count: i32,
149    pub max_retries: i32,
150    pub next_retry_at: Option<DateTime<Utc>>,
151    pub error_code: Option<String>,
152    pub error_message: Option<String>,
153    pub reverses_post_id: Option<Uuid>,
154    pub reversed_by_post_id: Option<Uuid>,
155    pub posted_by: Option<Uuid>,
156    pub notes: Option<String>,
157    pub metadata: serde_json::Value,
158}
159
160/// Summary view of AccountingPost for list displays
161#[derive(Debug, Clone, Serialize, Deserialize)]
162pub struct AccountingPostSummary {
163    pub id: AccountingPostId,
164}
165
166/// Reference to AccountingPost for foreign key relationships
167#[derive(Debug, Clone, Serialize, Deserialize)]
168pub struct AccountingPostRef {
169    pub id: AccountingPostId,
170}
171
172// ============================================================================
173// COSTCENTER TYPES
174// ============================================================================
175
176/// Type-safe ID for CostCenter
177///
178/// Use this instead of raw Uuid for type safety across modules.
179#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
180pub struct CostCenterId(pub Uuid);
181
182impl CostCenterId {
183    pub fn new(id: Uuid) -> Self {
184        Self(id)
185    }
186
187    pub fn into_inner(self) -> Uuid {
188        self.0
189    }
190}
191
192impl From<Uuid> for CostCenterId {
193    fn from(id: Uuid) -> Self {
194        Self(id)
195    }
196}
197
198impl From<CostCenterId> for Uuid {
199    fn from(id: CostCenterId) -> Self {
200        id.0
201    }
202}
203
204/// Data transfer object for CostCenter
205///
206/// This is the public representation of CostCenter for other modules.
207#[derive(Debug, Clone, Serialize, Deserialize)]
208pub struct CostCenterDto {
209    pub id: CostCenterId,
210    pub code: String,
211    pub name: String,
212    pub description: Option<String>,
213    pub parent_id: Option<Uuid>,
214    pub level: i32,
215    pub is_group: bool,
216    pub branch_id: Option<Uuid>,
217    pub status: CostCenterStatus,
218    pub sort_order: i32,
219    pub metadata: serde_json::Value,
220}
221
222/// Summary view of CostCenter for list displays
223#[derive(Debug, Clone, Serialize, Deserialize)]
224pub struct CostCenterSummary {
225    pub id: CostCenterId,
226    pub name: String,
227    pub status: CostCenterStatus,
228}
229
230/// Reference to CostCenter for foreign key relationships
231#[derive(Debug, Clone, Serialize, Deserialize)]
232pub struct CostCenterRef {
233    pub id: CostCenterId,
234}
235
236// ============================================================================
237// EMVQRCONFIG TYPES
238// ============================================================================
239
240/// Type-safe ID for EmvQrConfig
241///
242/// Use this instead of raw Uuid for type safety across modules.
243#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
244pub struct EmvQrConfigId(pub Uuid);
245
246impl EmvQrConfigId {
247    pub fn new(id: Uuid) -> Self {
248        Self(id)
249    }
250
251    pub fn into_inner(self) -> Uuid {
252        self.0
253    }
254}
255
256impl From<Uuid> for EmvQrConfigId {
257    fn from(id: Uuid) -> Self {
258        Self(id)
259    }
260}
261
262impl From<EmvQrConfigId> for Uuid {
263    fn from(id: EmvQrConfigId) -> Self {
264        id.0
265    }
266}
267
268/// Data transfer object for EmvQrConfig
269///
270/// This is the public representation of EmvQrConfig for other modules.
271#[derive(Debug, Clone, Serialize, Deserialize)]
272pub struct EmvQrConfigDto {
273    pub id: EmvQrConfigId,
274    pub merchant_name: String,
275    pub merchant_city: String,
276    pub country_code: String,
277    pub mcc: String,
278    pub gui: String,
279    pub merchant_identifier: String,
280    pub currency: String,
281    pub initiation_method: String,
282    pub bank_account_id: Option<Uuid>,
283    pub created_at: DateTime<Utc>,
284    pub updated_at: DateTime<Utc>,
285    pub metadata: serde_json::Value,
286}
287
288/// Summary view of EmvQrConfig for list displays
289#[derive(Debug, Clone, Serialize, Deserialize)]
290pub struct EmvQrConfigSummary {
291    pub id: EmvQrConfigId,
292    pub merchant_name: String,
293    pub created_at: DateTime<Utc>,
294}
295
296/// Reference to EmvQrConfig for foreign key relationships
297#[derive(Debug, Clone, Serialize, Deserialize)]
298pub struct EmvQrConfigRef {
299    pub id: EmvQrConfigId,
300}
301
302// ============================================================================
303// BANKCHECKSEQUENCE TYPES
304// ============================================================================
305
306/// Type-safe ID for BankCheckSequence
307///
308/// Use this instead of raw Uuid for type safety across modules.
309#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
310pub struct BankCheckSequenceId(pub Uuid);
311
312impl BankCheckSequenceId {
313    pub fn new(id: Uuid) -> Self {
314        Self(id)
315    }
316
317    pub fn into_inner(self) -> Uuid {
318        self.0
319    }
320}
321
322impl From<Uuid> for BankCheckSequenceId {
323    fn from(id: Uuid) -> Self {
324        Self(id)
325    }
326}
327
328impl From<BankCheckSequenceId> for Uuid {
329    fn from(id: BankCheckSequenceId) -> Self {
330        id.0
331    }
332}
333
334/// Data transfer object for BankCheckSequence
335///
336/// This is the public representation of BankCheckSequence for other modules.
337#[derive(Debug, Clone, Serialize, Deserialize)]
338pub struct BankCheckSequenceDto {
339    pub id: BankCheckSequenceId,
340    pub bank_account_id: Uuid,
341    pub numbering_mode: String,
342    pub next_number: i64,
343    pub created_at: DateTime<Utc>,
344    pub updated_at: DateTime<Utc>,
345    pub metadata: serde_json::Value,
346}
347
348/// Summary view of BankCheckSequence for list displays
349#[derive(Debug, Clone, Serialize, Deserialize)]
350pub struct BankCheckSequenceSummary {
351    pub id: BankCheckSequenceId,
352    pub created_at: DateTime<Utc>,
353}
354
355/// Reference to BankCheckSequence for foreign key relationships
356#[derive(Debug, Clone, Serialize, Deserialize)]
357pub struct BankCheckSequenceRef {
358    pub id: BankCheckSequenceId,
359}
360
361// ============================================================================
362// PRINTEDCHECK TYPES
363// ============================================================================
364
365/// Type-safe ID for PrintedCheck
366///
367/// Use this instead of raw Uuid for type safety across modules.
368#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
369pub struct PrintedCheckId(pub Uuid);
370
371impl PrintedCheckId {
372    pub fn new(id: Uuid) -> Self {
373        Self(id)
374    }
375
376    pub fn into_inner(self) -> Uuid {
377        self.0
378    }
379}
380
381impl From<Uuid> for PrintedCheckId {
382    fn from(id: Uuid) -> Self {
383        Self(id)
384    }
385}
386
387impl From<PrintedCheckId> for Uuid {
388    fn from(id: PrintedCheckId) -> Self {
389        id.0
390    }
391}
392
393/// Data transfer object for PrintedCheck
394///
395/// This is the public representation of PrintedCheck for other modules.
396#[derive(Debug, Clone, Serialize, Deserialize)]
397pub struct PrintedCheckDto {
398    pub id: PrintedCheckId,
399    pub bank_account_id: Uuid,
400    pub payment_id: Uuid,
401    pub payment_number: Option<String>,
402    pub check_number: String,
403    pub amount: Decimal,
404    pub payee_name: Option<String>,
405    pub status: String,
406    pub printed_at: DateTime<Utc>,
407    pub printed_by: Option<Uuid>,
408    pub created_at: DateTime<Utc>,
409    pub updated_at: DateTime<Utc>,
410    pub metadata: serde_json::Value,
411}
412
413/// Summary view of PrintedCheck for list displays
414#[derive(Debug, Clone, Serialize, Deserialize)]
415pub struct PrintedCheckSummary {
416    pub id: PrintedCheckId,
417    pub payee_name: Option<String>,
418    pub status: String,
419    pub created_at: DateTime<Utc>,
420}
421
422/// Reference to PrintedCheck for foreign key relationships
423#[derive(Debug, Clone, Serialize, Deserialize)]
424pub struct PrintedCheckRef {
425    pub id: PrintedCheckId,
426}
427
428// ============================================================================
429// TAXTAGREPAIRRUN TYPES
430// ============================================================================
431
432/// Type-safe ID for TaxTagRepairRun
433///
434/// Use this instead of raw Uuid for type safety across modules.
435#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
436pub struct TaxTagRepairRunId(pub Uuid);
437
438impl TaxTagRepairRunId {
439    pub fn new(id: Uuid) -> Self {
440        Self(id)
441    }
442
443    pub fn into_inner(self) -> Uuid {
444        self.0
445    }
446}
447
448impl From<Uuid> for TaxTagRepairRunId {
449    fn from(id: Uuid) -> Self {
450        Self(id)
451    }
452}
453
454impl From<TaxTagRepairRunId> for Uuid {
455    fn from(id: TaxTagRepairRunId) -> Self {
456        id.0
457    }
458}
459
460/// Data transfer object for TaxTagRepairRun
461///
462/// This is the public representation of TaxTagRepairRun for other modules.
463#[derive(Debug, Clone, Serialize, Deserialize)]
464pub struct TaxTagRepairRunDto {
465    pub id: TaxTagRepairRunId,
466    pub date_from: NaiveDate,
467    pub date_to: NaiveDate,
468    pub rules: serde_json::Value,
469    pub lines_examined: i64,
470    pub lines_retagged: i64,
471    pub dry_run: bool,
472    pub overridden_closed_periods: serde_json::Value,
473    pub actor: Option<Uuid>,
474    pub reason: String,
475    pub ran_at: DateTime<Utc>,
476    pub created_at: DateTime<Utc>,
477    pub updated_at: DateTime<Utc>,
478    pub metadata: serde_json::Value,
479}
480
481/// Summary view of TaxTagRepairRun for list displays
482#[derive(Debug, Clone, Serialize, Deserialize)]
483pub struct TaxTagRepairRunSummary {
484    pub id: TaxTagRepairRunId,
485    pub created_at: DateTime<Utc>,
486}
487
488/// Reference to TaxTagRepairRun for foreign key relationships
489#[derive(Debug, Clone, Serialize, Deserialize)]
490pub struct TaxTagRepairRunRef {
491    pub id: TaxTagRepairRunId,
492}
493
494// ============================================================================
495// FINANCIALSTATEMENT TYPES
496// ============================================================================
497
498/// Type-safe ID for FinancialStatement
499///
500/// Use this instead of raw Uuid for type safety across modules.
501#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
502pub struct FinancialStatementId(pub Uuid);
503
504impl FinancialStatementId {
505    pub fn new(id: Uuid) -> Self {
506        Self(id)
507    }
508
509    pub fn into_inner(self) -> Uuid {
510        self.0
511    }
512}
513
514impl From<Uuid> for FinancialStatementId {
515    fn from(id: Uuid) -> Self {
516        Self(id)
517    }
518}
519
520impl From<FinancialStatementId> for Uuid {
521    fn from(id: FinancialStatementId) -> Self {
522        id.0
523    }
524}
525
526/// Data transfer object for FinancialStatement
527///
528/// This is the public representation of FinancialStatement for other modules.
529#[derive(Debug, Clone, Serialize, Deserialize)]
530pub struct FinancialStatementDto {
531    pub id: FinancialStatementId,
532    pub statement_number: String,
533    pub statement_type: StatementType,
534    pub name: String,
535    pub fiscal_period_id: Option<Uuid>,
536    pub fiscal_year: i32,
537    pub fiscal_month: Option<i32>,
538    pub as_of_date: NaiveDate,
539    pub period_start: Option<NaiveDate>,
540    pub period_end: Option<NaiveDate>,
541    pub is_comparative: bool,
542    pub comparative_period_id: Option<Uuid>,
543    pub comparative_as_of_date: Option<NaiveDate>,
544    pub status: StatementStatus,
545    pub total_current_assets: Option<Decimal>,
546    pub total_non_current_assets: Option<Decimal>,
547    pub total_assets: Option<Decimal>,
548    pub total_current_liabilities: Option<Decimal>,
549    pub total_non_current_liabilities: Option<Decimal>,
550    pub total_liabilities: Option<Decimal>,
551    pub total_equity: Option<Decimal>,
552    pub balance_check: bool,
553    pub balance_difference: Option<Decimal>,
554    pub total_revenue: Option<Decimal>,
555    pub total_cogs: Option<Decimal>,
556    pub gross_profit: Option<Decimal>,
557    pub gross_profit_margin: Option<Decimal>,
558    pub total_operating_expenses: Option<Decimal>,
559    pub operating_income: Option<Decimal>,
560    pub operating_margin: Option<Decimal>,
561    pub total_other_income: Option<Decimal>,
562    pub total_other_expenses: Option<Decimal>,
563    pub income_before_tax: Option<Decimal>,
564    pub tax_expense: Option<Decimal>,
565    pub net_income: Option<Decimal>,
566    pub net_profit_margin: Option<Decimal>,
567    pub cash_from_operations: Option<Decimal>,
568    pub cash_from_investing: Option<Decimal>,
569    pub cash_from_financing: Option<Decimal>,
570    pub net_cash_change: Option<Decimal>,
571    pub beginning_cash: Option<Decimal>,
572    pub ending_cash: Option<Decimal>,
573    pub total_debits: Option<Decimal>,
574    pub total_credits: Option<Decimal>,
575    pub trial_balance_check: bool,
576    pub line_items: serde_json::Value,
577    pub comparative_data: serde_json::Value,
578    pub variance_data: serde_json::Value,
579    pub notes: serde_json::Value,
580    pub management_notes: Option<String>,
581    pub generated_at: Option<DateTime<Utc>>,
582    pub generated_by: Option<Uuid>,
583    pub generation_parameters: serde_json::Value,
584    pub reviewed_at: Option<DateTime<Utc>>,
585    pub reviewed_by: Option<Uuid>,
586    pub approved_at: Option<DateTime<Utc>>,
587    pub approved_by: Option<Uuid>,
588    pub published_at: Option<DateTime<Utc>>,
589    pub pdf_url: Option<String>,
590    pub excel_url: Option<String>,
591    pub currency: String,
592    pub metadata: serde_json::Value,
593}
594
595/// Summary view of FinancialStatement for list displays
596#[derive(Debug, Clone, Serialize, Deserialize)]
597pub struct FinancialStatementSummary {
598    pub id: FinancialStatementId,
599    pub name: String,
600    pub status: StatementStatus,
601}
602
603/// Reference to FinancialStatement for foreign key relationships
604#[derive(Debug, Clone, Serialize, Deserialize)]
605pub struct FinancialStatementRef {
606    pub id: FinancialStatementId,
607}
608
609// ============================================================================
610// FISCALPERIOD TYPES
611// ============================================================================
612
613/// Type-safe ID for FiscalPeriod
614///
615/// Use this instead of raw Uuid for type safety across modules.
616#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
617pub struct FiscalPeriodId(pub Uuid);
618
619impl FiscalPeriodId {
620    pub fn new(id: Uuid) -> Self {
621        Self(id)
622    }
623
624    pub fn into_inner(self) -> Uuid {
625        self.0
626    }
627}
628
629impl From<Uuid> for FiscalPeriodId {
630    fn from(id: Uuid) -> Self {
631        Self(id)
632    }
633}
634
635impl From<FiscalPeriodId> for Uuid {
636    fn from(id: FiscalPeriodId) -> Self {
637        id.0
638    }
639}
640
641/// Data transfer object for FiscalPeriod
642///
643/// This is the public representation of FiscalPeriod for other modules.
644#[derive(Debug, Clone, Serialize, Deserialize)]
645pub struct FiscalPeriodDto {
646    pub id: FiscalPeriodId,
647    pub period_code: String,
648    pub name: String,
649    pub period_type: PeriodType,
650    pub start_date: NaiveDate,
651    pub end_date: NaiveDate,
652    pub fiscal_year: i32,
653    pub fiscal_quarter: Option<i32>,
654    pub fiscal_month: Option<i32>,
655    pub parent_id: Option<Uuid>,
656    pub level: i32,
657    pub status: PeriodStatus,
658    pub is_current: bool,
659    pub opening_balance_set: bool,
660    pub opening_balance_date: Option<DateTime<Utc>>,
661    pub opening_balance_by: Option<Uuid>,
662    pub closing_started_at: Option<DateTime<Utc>>,
663    pub closing_started_by: Option<Uuid>,
664    pub closed_at: Option<DateTime<Utc>>,
665    pub closed_by: Option<Uuid>,
666    pub locked_at: Option<DateTime<Utc>>,
667    pub locked_by: Option<Uuid>,
668    pub lock_reason: Option<String>,
669    pub reopened_at: Option<DateTime<Utc>>,
670    pub reopened_by: Option<Uuid>,
671    pub reopen_reason: Option<String>,
672    pub allow_adjustments: bool,
673    pub adjustment_deadline: Option<NaiveDate>,
674    pub total_debits: Decimal,
675    pub total_credits: Decimal,
676    pub journal_count: i32,
677    pub total_revenue: Decimal,
678    pub total_expenses: Decimal,
679    pub net_income: Decimal,
680    pub total_assets: Decimal,
681    pub total_liabilities: Decimal,
682    pub total_equity: Decimal,
683    pub balance_sheet_generated: bool,
684    pub income_statement_generated: bool,
685    pub statements_generated_at: Option<DateTime<Utc>>,
686    pub notes: Option<String>,
687    pub metadata: serde_json::Value,
688}
689
690/// Summary view of FiscalPeriod for list displays
691#[derive(Debug, Clone, Serialize, Deserialize)]
692pub struct FiscalPeriodSummary {
693    pub id: FiscalPeriodId,
694    pub name: String,
695    pub status: PeriodStatus,
696}
697
698/// Reference to FiscalPeriod for foreign key relationships
699#[derive(Debug, Clone, Serialize, Deserialize)]
700pub struct FiscalPeriodRef {
701    pub id: FiscalPeriodId,
702}
703
704// ============================================================================
705// JOURNAL TYPES
706// ============================================================================
707
708/// Type-safe ID for Journal
709///
710/// Use this instead of raw Uuid for type safety across modules.
711#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
712pub struct JournalId(pub Uuid);
713
714impl JournalId {
715    pub fn new(id: Uuid) -> Self {
716        Self(id)
717    }
718
719    pub fn into_inner(self) -> Uuid {
720        self.0
721    }
722}
723
724impl From<Uuid> for JournalId {
725    fn from(id: Uuid) -> Self {
726        Self(id)
727    }
728}
729
730impl From<JournalId> for Uuid {
731    fn from(id: JournalId) -> Self {
732        id.0
733    }
734}
735
736/// Data transfer object for Journal
737///
738/// This is the public representation of Journal for other modules.
739#[derive(Debug, Clone, Serialize, Deserialize)]
740pub struct JournalDto {
741    pub id: JournalId,
742    pub journal_number: String,
743    pub reference_number: Option<String>,
744    pub journal_type: JournalType,
745    pub branch_id: Option<Uuid>,
746    pub transaction_date: NaiveDate,
747    pub posting_date: Option<NaiveDate>,
748    pub fiscal_period_id: Option<Uuid>,
749    pub fiscal_year: Option<i32>,
750    pub fiscal_month: Option<i32>,
751    pub description: String,
752    pub notes: Option<String>,
753    pub currency: String,
754    pub total_debit: Decimal,
755    pub total_credit: Decimal,
756    pub line_count: i32,
757    pub source: JournalSource,
758    pub source_type: Option<String>,
759    pub source_id: Option<Uuid>,
760    pub source_reference: Option<String>,
761    pub is_reversed: bool,
762    pub reversed_by_id: Option<Uuid>,
763    pub reversed_at: Option<DateTime<Utc>>,
764    pub reversal_reason: Option<String>,
765    pub reverses_id: Option<Uuid>,
766    pub is_reversing: bool,
767    pub auto_reverse: bool,
768    pub auto_reverse_date: Option<NaiveDate>,
769    pub status: JournalStatus,
770    pub requires_approval: bool,
771    pub approval_threshold: Option<Decimal>,
772    pub submitted_at: Option<DateTime<Utc>>,
773    pub submitted_by: Option<Uuid>,
774    pub approved_at: Option<DateTime<Utc>>,
775    pub approved_by: Option<Uuid>,
776    pub rejected_at: Option<DateTime<Utc>>,
777    pub rejected_by: Option<Uuid>,
778    pub rejection_reason: Option<String>,
779    pub posted_at: Option<DateTime<Utc>>,
780    pub posted_by: Option<Uuid>,
781    pub is_voided: bool,
782    pub voided_at: Option<DateTime<Utc>>,
783    pub voided_by: Option<Uuid>,
784    pub void_reason: Option<String>,
785    pub attachments: serde_json::Value,
786    pub metadata: serde_json::Value,
787}
788
789/// Summary view of Journal for list displays
790#[derive(Debug, Clone, Serialize, Deserialize)]
791pub struct JournalSummary {
792    pub id: JournalId,
793    pub status: JournalStatus,
794}
795
796/// Reference to Journal for foreign key relationships
797#[derive(Debug, Clone, Serialize, Deserialize)]
798pub struct JournalRef {
799    pub id: JournalId,
800}
801
802// ============================================================================
803// JOURNALLINE TYPES
804// ============================================================================
805
806/// Type-safe ID for JournalLine
807///
808/// Use this instead of raw Uuid for type safety across modules.
809#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
810pub struct JournalLineId(pub Uuid);
811
812impl JournalLineId {
813    pub fn new(id: Uuid) -> Self {
814        Self(id)
815    }
816
817    pub fn into_inner(self) -> Uuid {
818        self.0
819    }
820}
821
822impl From<Uuid> for JournalLineId {
823    fn from(id: Uuid) -> Self {
824        Self(id)
825    }
826}
827
828impl From<JournalLineId> for Uuid {
829    fn from(id: JournalLineId) -> Self {
830        id.0
831    }
832}
833
834/// Data transfer object for JournalLine
835///
836/// This is the public representation of JournalLine for other modules.
837#[derive(Debug, Clone, Serialize, Deserialize)]
838pub struct JournalLineDto {
839    pub id: JournalLineId,
840    pub journal_id: Uuid,
841    pub branch_id: Option<Uuid>,
842    pub party_type: Option<PartyType>,
843    pub party_id: Option<Uuid>,
844    pub line_number: i32,
845    pub account_id: Uuid,
846    pub account_number: String,
847    pub account_name: String,
848    pub debit_amount: Decimal,
849    pub credit_amount: Decimal,
850    pub currency: String,
851    pub exchange_rate: Decimal,
852    pub base_debit_amount: Decimal,
853    pub base_credit_amount: Decimal,
854    pub description: Option<String>,
855    pub cost_center_id: Option<Uuid>,
856    pub project_id: Option<Uuid>,
857    pub department_id: Option<Uuid>,
858    pub dimensions: Option<serde_json::Value>,
859    pub source_type: Option<String>,
860    pub source_id: Option<Uuid>,
861    pub source_reference: Option<String>,
862    pub is_tax_line: bool,
863    pub tax_rate: Option<Decimal>,
864    pub tax_base_amount: Option<Decimal>,
865    pub related_line_id: Option<Uuid>,
866    pub has_quantity: bool,
867    pub quantity: Option<Decimal>,
868    pub unit: Option<String>,
869    pub unit_price: Option<Decimal>,
870    pub is_reconciled: bool,
871    pub reconciliation_id: Option<Uuid>,
872    pub reconciled_at: Option<DateTime<Utc>>,
873    pub full_reconcile_id: Option<Uuid>,
874    pub is_posted: bool,
875    pub ledger_id: Option<Uuid>,
876    pub posted_at: Option<DateTime<Utc>>,
877    pub tags: serde_json::Value,
878    pub data: serde_json::Value,
879}
880
881/// Summary view of JournalLine for list displays
882#[derive(Debug, Clone, Serialize, Deserialize)]
883pub struct JournalLineSummary {
884    pub id: JournalLineId,
885    pub account_name: String,
886}
887
888/// Reference to JournalLine for foreign key relationships
889#[derive(Debug, Clone, Serialize, Deserialize)]
890pub struct JournalLineRef {
891    pub id: JournalLineId,
892}
893
894// ============================================================================
895// LEDGER TYPES
896// ============================================================================
897
898/// Type-safe ID for Ledger
899///
900/// Use this instead of raw Uuid for type safety across modules.
901#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
902pub struct LedgerId(pub Uuid);
903
904impl LedgerId {
905    pub fn new(id: Uuid) -> Self {
906        Self(id)
907    }
908
909    pub fn into_inner(self) -> Uuid {
910        self.0
911    }
912}
913
914impl From<Uuid> for LedgerId {
915    fn from(id: Uuid) -> Self {
916        Self(id)
917    }
918}
919
920impl From<LedgerId> for Uuid {
921    fn from(id: LedgerId) -> Self {
922        id.0
923    }
924}
925
926/// Data transfer object for Ledger
927///
928/// This is the public representation of Ledger for other modules.
929#[derive(Debug, Clone, Serialize, Deserialize)]
930pub struct LedgerDto {
931    pub id: LedgerId,
932    pub account_id: Uuid,
933    pub account_number: String,
934    pub account_name: String,
935    pub account_type: AccountType,
936    pub normal_balance: NormalBalance,
937    pub journal_id: Uuid,
938    pub journal_number: String,
939    pub journal_line_id: Uuid,
940    pub transaction_date: NaiveDate,
941    pub posting_date: NaiveDate,
942    pub fiscal_period_id: Option<Uuid>,
943    pub fiscal_year: i32,
944    pub fiscal_month: i32,
945    pub description: String,
946    pub reference: Option<String>,
947    pub currency: String,
948    pub debit_amount: Decimal,
949    pub credit_amount: Decimal,
950    pub balance_before: Decimal,
951    pub balance_after: Decimal,
952    pub balance_change: Decimal,
953    pub sequence_number: i32,
954    pub branch_id: Option<Uuid>,
955    pub party_type: Option<PartyType>,
956    pub party_id: Option<Uuid>,
957    pub cost_center_id: Option<Uuid>,
958    pub project_id: Option<Uuid>,
959    pub department_id: Option<Uuid>,
960    pub dimensions: Option<serde_json::Value>,
961    pub source_type: Option<String>,
962    pub source_id: Option<Uuid>,
963    pub source_reference: Option<String>,
964    pub is_reconciled: bool,
965    pub reconciliation_id: Option<Uuid>,
966    pub reconciled_at: Option<DateTime<Utc>>,
967    pub is_opening_balance: bool,
968    pub is_closing_entry: bool,
969    pub is_adjustment: bool,
970    pub is_reversed: bool,
971    pub reversed_by_id: Option<Uuid>,
972    pub reverses_id: Option<Uuid>,
973    pub metadata: serde_json::Value,
974}
975
976/// Summary view of Ledger for list displays
977#[derive(Debug, Clone, Serialize, Deserialize)]
978pub struct LedgerSummary {
979    pub id: LedgerId,
980    pub account_name: String,
981}
982
983/// Reference to Ledger for foreign key relationships
984#[derive(Debug, Clone, Serialize, Deserialize)]
985pub struct LedgerRef {
986    pub id: LedgerId,
987}
988
989// ============================================================================
990// RECONCILIATION TYPES
991// ============================================================================
992
993/// Type-safe ID for Reconciliation
994///
995/// Use this instead of raw Uuid for type safety across modules.
996#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
997pub struct ReconciliationId(pub Uuid);
998
999impl ReconciliationId {
1000    pub fn new(id: Uuid) -> Self {
1001        Self(id)
1002    }
1003
1004    pub fn into_inner(self) -> Uuid {
1005        self.0
1006    }
1007}
1008
1009impl From<Uuid> for ReconciliationId {
1010    fn from(id: Uuid) -> Self {
1011        Self(id)
1012    }
1013}
1014
1015impl From<ReconciliationId> for Uuid {
1016    fn from(id: ReconciliationId) -> Self {
1017        id.0
1018    }
1019}
1020
1021/// Data transfer object for Reconciliation
1022///
1023/// This is the public representation of Reconciliation for other modules.
1024#[derive(Debug, Clone, Serialize, Deserialize)]
1025pub struct ReconciliationDto {
1026    pub id: ReconciliationId,
1027    pub reconciliation_number: String,
1028    pub account_id: Uuid,
1029    pub account_number: String,
1030    pub account_name: String,
1031    pub reconciliation_type: ReconciliationType,
1032    pub period_start: NaiveDate,
1033    pub period_end: NaiveDate,
1034    pub statement_date: NaiveDate,
1035    pub opening_book_balance: Decimal,
1036    pub opening_statement_balance: Decimal,
1037    pub previous_reconciliation_id: Option<Uuid>,
1038    pub closing_book_balance: Decimal,
1039    pub closing_statement_balance: Decimal,
1040    pub total_matched_debits: Decimal,
1041    pub total_matched_credits: Decimal,
1042    pub matched_count: i32,
1043    pub total_unmatched_book_debits: Decimal,
1044    pub total_unmatched_book_credits: Decimal,
1045    pub unmatched_book_count: i32,
1046    pub total_unmatched_statement_debits: Decimal,
1047    pub total_unmatched_statement_credits: Decimal,
1048    pub unmatched_statement_count: i32,
1049    pub outstanding_deposits: Decimal,
1050    pub outstanding_checks: Decimal,
1051    pub deposits_in_transit: Decimal,
1052    pub bank_charges: Decimal,
1053    pub bank_interest: Decimal,
1054    pub nsf_checks: Decimal,
1055    pub other_adjustments: Decimal,
1056    pub adjusted_book_balance: Option<Decimal>,
1057    pub adjusted_statement_balance: Option<Decimal>,
1058    pub difference: Decimal,
1059    pub is_balanced: bool,
1060    pub status: ReconciliationStatus,
1061    pub started_at: Option<DateTime<Utc>>,
1062    pub started_by: Option<Uuid>,
1063    pub completed_at: Option<DateTime<Utc>>,
1064    pub completed_by: Option<Uuid>,
1065    pub reviewed_at: Option<DateTime<Utc>>,
1066    pub reviewed_by: Option<Uuid>,
1067    pub has_adjusting_entries: bool,
1068    pub adjusting_journal_ids: serde_json::Value,
1069    pub statement_source: Option<String>,
1070    pub statement_file_url: Option<String>,
1071    pub import_date: Option<DateTime<Utc>>,
1072    pub notes: Option<String>,
1073    pub discrepancy_notes: Option<String>,
1074    pub metadata: serde_json::Value,
1075}
1076
1077/// Summary view of Reconciliation for list displays
1078#[derive(Debug, Clone, Serialize, Deserialize)]
1079pub struct ReconciliationSummary {
1080    pub id: ReconciliationId,
1081    pub account_name: String,
1082    pub status: ReconciliationStatus,
1083}
1084
1085/// Reference to Reconciliation for foreign key relationships
1086#[derive(Debug, Clone, Serialize, Deserialize)]
1087pub struct ReconciliationRef {
1088    pub id: ReconciliationId,
1089}
1090
1091// ============================================================================
1092// RECONCILIATIONITEM TYPES
1093// ============================================================================
1094
1095/// Type-safe ID for ReconciliationItem
1096///
1097/// Use this instead of raw Uuid for type safety across modules.
1098#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1099pub struct ReconciliationItemId(pub Uuid);
1100
1101impl ReconciliationItemId {
1102    pub fn new(id: Uuid) -> Self {
1103        Self(id)
1104    }
1105
1106    pub fn into_inner(self) -> Uuid {
1107        self.0
1108    }
1109}
1110
1111impl From<Uuid> for ReconciliationItemId {
1112    fn from(id: Uuid) -> Self {
1113        Self(id)
1114    }
1115}
1116
1117impl From<ReconciliationItemId> for Uuid {
1118    fn from(id: ReconciliationItemId) -> Self {
1119        id.0
1120    }
1121}
1122
1123/// Data transfer object for ReconciliationItem
1124///
1125/// This is the public representation of ReconciliationItem for other modules.
1126#[derive(Debug, Clone, Serialize, Deserialize)]
1127pub struct ReconciliationItemDto {
1128    pub id: ReconciliationItemId,
1129    pub reconciliation_id: Uuid,
1130    pub item_number: i32,
1131    pub source: String,
1132    pub ledger_id: Option<Uuid>,
1133    pub journal_id: Option<Uuid>,
1134    pub book_date: Option<NaiveDate>,
1135    pub book_reference: Option<String>,
1136    pub book_description: Option<String>,
1137    pub book_debit: Decimal,
1138    pub book_credit: Decimal,
1139    pub statement_date: Option<NaiveDate>,
1140    pub statement_reference: Option<String>,
1141    pub statement_description: Option<String>,
1142    pub statement_debit: Decimal,
1143    pub statement_credit: Decimal,
1144    pub status: ReconciliationItemStatus,
1145    pub matched_with_id: Option<Uuid>,
1146    pub match_date: Option<DateTime<Utc>>,
1147    pub match_method: Option<String>,
1148    pub match_confidence: Option<Decimal>,
1149    pub has_difference: bool,
1150    pub difference_amount: Decimal,
1151    pub difference_reason: Option<String>,
1152    pub requires_adjustment: bool,
1153    pub adjustment_type: Option<String>,
1154    pub adjustment_journal_id: Option<Uuid>,
1155    pub adjusted_at: Option<DateTime<Utc>>,
1156    pub is_written_off: bool,
1157    pub write_off_reason: Option<String>,
1158    pub write_off_approved_by: Option<Uuid>,
1159    pub is_outstanding: bool,
1160    pub outstanding_type: Option<String>,
1161    pub expected_clear_date: Option<NaiveDate>,
1162    pub notes: Option<String>,
1163    pub data: serde_json::Value,
1164}
1165
1166/// Summary view of ReconciliationItem for list displays
1167#[derive(Debug, Clone, Serialize, Deserialize)]
1168pub struct ReconciliationItemSummary {
1169    pub id: ReconciliationItemId,
1170    pub status: ReconciliationItemStatus,
1171}
1172
1173/// Reference to ReconciliationItem for foreign key relationships
1174#[derive(Debug, Clone, Serialize, Deserialize)]
1175pub struct ReconciliationItemRef {
1176    pub id: ReconciliationItemId,
1177}
1178
1179// ============================================================================
1180// FULLRECONCILE TYPES
1181// ============================================================================
1182
1183/// Type-safe ID for FullReconcile
1184///
1185/// Use this instead of raw Uuid for type safety across modules.
1186#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1187pub struct FullReconcileId(pub Uuid);
1188
1189impl FullReconcileId {
1190    pub fn new(id: Uuid) -> Self {
1191        Self(id)
1192    }
1193
1194    pub fn into_inner(self) -> Uuid {
1195        self.0
1196    }
1197}
1198
1199impl From<Uuid> for FullReconcileId {
1200    fn from(id: Uuid) -> Self {
1201        Self(id)
1202    }
1203}
1204
1205impl From<FullReconcileId> for Uuid {
1206    fn from(id: FullReconcileId) -> Self {
1207        id.0
1208    }
1209}
1210
1211/// Data transfer object for FullReconcile
1212///
1213/// This is the public representation of FullReconcile for other modules.
1214#[derive(Debug, Clone, Serialize, Deserialize)]
1215pub struct FullReconcileDto {
1216    pub id: FullReconcileId,
1217    pub exchange_total: Decimal,
1218    pub reconciled_at: DateTime<Utc>,
1219    pub created_at: DateTime<Utc>,
1220    pub updated_at: DateTime<Utc>,
1221    pub metadata: Option<serde_json::Value>,
1222}
1223
1224/// Summary view of FullReconcile for list displays
1225#[derive(Debug, Clone, Serialize, Deserialize)]
1226pub struct FullReconcileSummary {
1227    pub id: FullReconcileId,
1228    pub created_at: DateTime<Utc>,
1229}
1230
1231/// Reference to FullReconcile for foreign key relationships
1232#[derive(Debug, Clone, Serialize, Deserialize)]
1233pub struct FullReconcileRef {
1234    pub id: FullReconcileId,
1235}
1236
1237// ============================================================================
1238// PARTIALRECONCILE TYPES
1239// ============================================================================
1240
1241/// Type-safe ID for PartialReconcile
1242///
1243/// Use this instead of raw Uuid for type safety across modules.
1244#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1245pub struct PartialReconcileId(pub Uuid);
1246
1247impl PartialReconcileId {
1248    pub fn new(id: Uuid) -> Self {
1249        Self(id)
1250    }
1251
1252    pub fn into_inner(self) -> Uuid {
1253        self.0
1254    }
1255}
1256
1257impl From<Uuid> for PartialReconcileId {
1258    fn from(id: Uuid) -> Self {
1259        Self(id)
1260    }
1261}
1262
1263impl From<PartialReconcileId> for Uuid {
1264    fn from(id: PartialReconcileId) -> Self {
1265        id.0
1266    }
1267}
1268
1269/// Data transfer object for PartialReconcile
1270///
1271/// This is the public representation of PartialReconcile for other modules.
1272#[derive(Debug, Clone, Serialize, Deserialize)]
1273pub struct PartialReconcileDto {
1274    pub id: PartialReconcileId,
1275    pub debit_move_id: Uuid,
1276    pub credit_move_id: Uuid,
1277    pub full_reconcile_id: Option<Uuid>,
1278    pub exchange_move_id: Option<Uuid>,
1279    pub amount: Decimal,
1280    pub debit_amount_currency: Option<Decimal>,
1281    pub credit_amount_currency: Option<Decimal>,
1282    pub currency: String,
1283    pub max_date: NaiveDate,
1284    pub origin: ReconcileOrigin,
1285    pub source_type: Option<String>,
1286    pub source_id: Option<Uuid>,
1287    pub created_at: DateTime<Utc>,
1288    pub updated_at: DateTime<Utc>,
1289    pub metadata: Option<serde_json::Value>,
1290}
1291
1292/// Summary view of PartialReconcile for list displays
1293#[derive(Debug, Clone, Serialize, Deserialize)]
1294pub struct PartialReconcileSummary {
1295    pub id: PartialReconcileId,
1296    pub created_at: DateTime<Utc>,
1297}
1298
1299/// Reference to PartialReconcile for foreign key relationships
1300#[derive(Debug, Clone, Serialize, Deserialize)]
1301pub struct PartialReconcileRef {
1302    pub id: PartialReconcileId,
1303}
1304
1305// ============================================================================
1306// CUSTOM TYPES
1307// ============================================================================
1308
1309// Add custom public types here