Skip to main content

backbone_payroll/exports/
types.rs

1//! Public types for Payroll 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// COMPENSATIONCHANGE TYPES
16// ============================================================================
17
18/// Type-safe ID for CompensationChange
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 CompensationChangeId(pub Uuid);
23
24impl CompensationChangeId {
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 CompensationChangeId {
35    fn from(id: Uuid) -> Self {
36        Self(id)
37    }
38}
39
40impl From<CompensationChangeId> for Uuid {
41    fn from(id: CompensationChangeId) -> Self {
42        id.0
43    }
44}
45
46/// Data transfer object for CompensationChange
47///
48/// This is the public representation of CompensationChange for other modules.
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct CompensationChangeDto {
51    pub id: CompensationChangeId,
52    pub employee_id: Uuid,
53    pub change_type: CompensationChangeType,
54    pub new_amount: Option<Decimal>,
55    pub effective_date: Option<NaiveDate>,
56    pub reference_id: Option<Uuid>,
57    pub note: Option<String>,
58    pub metadata: serde_json::Value,
59}
60
61/// Summary view of CompensationChange for list displays
62#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct CompensationChangeSummary {
64    pub id: CompensationChangeId,
65}
66
67/// Reference to CompensationChange for foreign key relationships
68#[derive(Debug, Clone, Serialize, Deserialize)]
69pub struct CompensationChangeRef {
70    pub id: CompensationChangeId,
71}
72
73// ============================================================================
74// PAYROLLENTRY TYPES
75// ============================================================================
76
77/// Type-safe ID for PayrollEntry
78///
79/// Use this instead of raw Uuid for type safety across modules.
80#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
81pub struct PayrollEntryId(pub Uuid);
82
83impl PayrollEntryId {
84    pub fn new(id: Uuid) -> Self {
85        Self(id)
86    }
87
88    pub fn into_inner(self) -> Uuid {
89        self.0
90    }
91}
92
93impl From<Uuid> for PayrollEntryId {
94    fn from(id: Uuid) -> Self {
95        Self(id)
96    }
97}
98
99impl From<PayrollEntryId> for Uuid {
100    fn from(id: PayrollEntryId) -> Self {
101        id.0
102    }
103}
104
105/// Data transfer object for PayrollEntry
106///
107/// This is the public representation of PayrollEntry for other modules.
108#[derive(Debug, Clone, Serialize, Deserialize)]
109pub struct PayrollEntryDto {
110    pub id: PayrollEntryId,
111    pub period_year: i32,
112    pub period_month: i32,
113    pub posting_date: Option<DateTime<Utc>>,
114    pub timesheet_approval_id: Option<Uuid>,
115    pub period_start: Option<NaiveDate>,
116    pub period_end: Option<NaiveDate>,
117    pub status: PayrollStatus,
118    pub salary_expense_account_id: Option<Uuid>,
119    pub salary_payable_account_id: Option<Uuid>,
120    pub total_gross: Decimal,
121    pub total_deductions: Decimal,
122    pub total_net: Decimal,
123    pub journal_id: Option<Uuid>,
124    pub accounting_post_id: Option<Uuid>,
125    pub metadata: serde_json::Value,
126}
127
128/// Summary view of PayrollEntry for list displays
129#[derive(Debug, Clone, Serialize, Deserialize)]
130pub struct PayrollEntrySummary {
131    pub id: PayrollEntryId,
132    pub status: PayrollStatus,
133}
134
135/// Reference to PayrollEntry for foreign key relationships
136#[derive(Debug, Clone, Serialize, Deserialize)]
137pub struct PayrollEntryRef {
138    pub id: PayrollEntryId,
139}
140
141// ============================================================================
142// SALARYSLIP TYPES
143// ============================================================================
144
145/// Type-safe ID for SalarySlip
146///
147/// Use this instead of raw Uuid for type safety across modules.
148#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
149pub struct SalarySlipId(pub Uuid);
150
151impl SalarySlipId {
152    pub fn new(id: Uuid) -> Self {
153        Self(id)
154    }
155
156    pub fn into_inner(self) -> Uuid {
157        self.0
158    }
159}
160
161impl From<Uuid> for SalarySlipId {
162    fn from(id: Uuid) -> Self {
163        Self(id)
164    }
165}
166
167impl From<SalarySlipId> for Uuid {
168    fn from(id: SalarySlipId) -> Self {
169        id.0
170    }
171}
172
173/// Data transfer object for SalarySlip
174///
175/// This is the public representation of SalarySlip for other modules.
176#[derive(Debug, Clone, Serialize, Deserialize)]
177pub struct SalarySlipDto {
178    pub id: SalarySlipId,
179    pub payroll_entry_id: Uuid,
180    pub employee_id: Uuid,
181    pub structure_id: Option<Uuid>,
182    pub working_days: Decimal,
183    pub unpaid_days: Decimal,
184    pub gross_pay: Decimal,
185    pub total_deductions: Decimal,
186    pub net_pay: Decimal,
187    pub overtime_hours: Option<Decimal>,
188    pub tax_method: Option<String>,
189    pub metadata: serde_json::Value,
190}
191
192/// Summary view of SalarySlip for list displays
193#[derive(Debug, Clone, Serialize, Deserialize)]
194pub struct SalarySlipSummary {
195    pub id: SalarySlipId,
196}
197
198/// Reference to SalarySlip for foreign key relationships
199#[derive(Debug, Clone, Serialize, Deserialize)]
200pub struct SalarySlipRef {
201    pub id: SalarySlipId,
202}
203
204// ============================================================================
205// SALARYSLIPLINE TYPES
206// ============================================================================
207
208/// Type-safe ID for SalarySlipLine
209///
210/// Use this instead of raw Uuid for type safety across modules.
211#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
212pub struct SalarySlipLineId(pub Uuid);
213
214impl SalarySlipLineId {
215    pub fn new(id: Uuid) -> Self {
216        Self(id)
217    }
218
219    pub fn into_inner(self) -> Uuid {
220        self.0
221    }
222}
223
224impl From<Uuid> for SalarySlipLineId {
225    fn from(id: Uuid) -> Self {
226        Self(id)
227    }
228}
229
230impl From<SalarySlipLineId> for Uuid {
231    fn from(id: SalarySlipLineId) -> Self {
232        id.0
233    }
234}
235
236/// Data transfer object for SalarySlipLine
237///
238/// This is the public representation of SalarySlipLine for other modules.
239#[derive(Debug, Clone, Serialize, Deserialize)]
240pub struct SalarySlipLineDto {
241    pub id: SalarySlipLineId,
242    pub salary_slip_id: Uuid,
243    pub name: String,
244    pub component_type: ComponentType,
245    pub is_statutory: bool,
246    pub amount: Decimal,
247    pub gl_account_id: Uuid,
248    pub source_kind: Option<String>,
249    pub source_ref: Option<Uuid>,
250    pub metadata: serde_json::Value,
251}
252
253/// Summary view of SalarySlipLine for list displays
254#[derive(Debug, Clone, Serialize, Deserialize)]
255pub struct SalarySlipLineSummary {
256    pub id: SalarySlipLineId,
257    pub name: String,
258}
259
260/// Reference to SalarySlipLine for foreign key relationships
261#[derive(Debug, Clone, Serialize, Deserialize)]
262pub struct SalarySlipLineRef {
263    pub id: SalarySlipLineId,
264}
265
266// ============================================================================
267// SALARYSTRUCTURE TYPES
268// ============================================================================
269
270/// Type-safe ID for SalaryStructure
271///
272/// Use this instead of raw Uuid for type safety across modules.
273#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
274pub struct SalaryStructureId(pub Uuid);
275
276impl SalaryStructureId {
277    pub fn new(id: Uuid) -> Self {
278        Self(id)
279    }
280
281    pub fn into_inner(self) -> Uuid {
282        self.0
283    }
284}
285
286impl From<Uuid> for SalaryStructureId {
287    fn from(id: Uuid) -> Self {
288        Self(id)
289    }
290}
291
292impl From<SalaryStructureId> for Uuid {
293    fn from(id: SalaryStructureId) -> Self {
294        id.0
295    }
296}
297
298/// Data transfer object for SalaryStructure
299///
300/// This is the public representation of SalaryStructure for other modules.
301#[derive(Debug, Clone, Serialize, Deserialize)]
302pub struct SalaryStructureDto {
303    pub id: SalaryStructureId,
304    pub name: String,
305    pub status: SalaryStructureStatus,
306    pub metadata: serde_json::Value,
307}
308
309/// Summary view of SalaryStructure for list displays
310#[derive(Debug, Clone, Serialize, Deserialize)]
311pub struct SalaryStructureSummary {
312    pub id: SalaryStructureId,
313    pub name: String,
314    pub status: SalaryStructureStatus,
315}
316
317/// Reference to SalaryStructure for foreign key relationships
318#[derive(Debug, Clone, Serialize, Deserialize)]
319pub struct SalaryStructureRef {
320    pub id: SalaryStructureId,
321}
322
323// ============================================================================
324// SALARYCOMPONENT TYPES
325// ============================================================================
326
327/// Type-safe ID for SalaryComponent
328///
329/// Use this instead of raw Uuid for type safety across modules.
330#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
331pub struct SalaryComponentId(pub Uuid);
332
333impl SalaryComponentId {
334    pub fn new(id: Uuid) -> Self {
335        Self(id)
336    }
337
338    pub fn into_inner(self) -> Uuid {
339        self.0
340    }
341}
342
343impl From<Uuid> for SalaryComponentId {
344    fn from(id: Uuid) -> Self {
345        Self(id)
346    }
347}
348
349impl From<SalaryComponentId> for Uuid {
350    fn from(id: SalaryComponentId) -> Self {
351        id.0
352    }
353}
354
355/// Data transfer object for SalaryComponent
356///
357/// This is the public representation of SalaryComponent for other modules.
358#[derive(Debug, Clone, Serialize, Deserialize)]
359pub struct SalaryComponentDto {
360    pub id: SalaryComponentId,
361    pub structure_id: Uuid,
362    pub name: String,
363    pub component_type: ComponentType,
364    pub amount: Decimal,
365    pub gl_account_id: Uuid,
366    pub is_statutory: bool,
367    pub metadata: serde_json::Value,
368}
369
370/// Summary view of SalaryComponent for list displays
371#[derive(Debug, Clone, Serialize, Deserialize)]
372pub struct SalaryComponentSummary {
373    pub id: SalaryComponentId,
374    pub name: String,
375}
376
377/// Reference to SalaryComponent for foreign key relationships
378#[derive(Debug, Clone, Serialize, Deserialize)]
379pub struct SalaryComponentRef {
380    pub id: SalaryComponentId,
381}
382
383// ============================================================================
384// CUSTOM TYPES
385// ============================================================================
386
387// <<< CUSTOM TYPES START >>>
388// Add custom public types here
389// <<< CUSTOM TYPES END >>>