1use serde::{Deserialize, Serialize};
9use uuid::Uuid;
10use chrono::{DateTime, Utc, NaiveDate};
11use rust_decimal::Decimal;
12use crate::domain::entity::*;
13
14#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct CompensationChangeSummary {
64 pub id: CompensationChangeId,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69pub struct CompensationChangeRef {
70 pub id: CompensationChangeId,
71}
72
73#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
130pub struct PayrollEntrySummary {
131 pub id: PayrollEntryId,
132 pub status: PayrollStatus,
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137pub struct PayrollEntryRef {
138 pub id: PayrollEntryId,
139}
140
141#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
194pub struct SalarySlipSummary {
195 pub id: SalarySlipId,
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200pub struct SalarySlipRef {
201 pub id: SalarySlipId,
202}
203
204#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
255pub struct SalarySlipLineSummary {
256 pub id: SalarySlipLineId,
257 pub name: String,
258}
259
260#[derive(Debug, Clone, Serialize, Deserialize)]
262pub struct SalarySlipLineRef {
263 pub id: SalarySlipLineId,
264}
265
266#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
311pub struct SalaryStructureSummary {
312 pub id: SalaryStructureId,
313 pub name: String,
314 pub status: SalaryStructureStatus,
315}
316
317#[derive(Debug, Clone, Serialize, Deserialize)]
319pub struct SalaryStructureRef {
320 pub id: SalaryStructureId,
321}
322
323#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
372pub struct SalaryComponentSummary {
373 pub id: SalaryComponentId,
374 pub name: String,
375}
376
377#[derive(Debug, Clone, Serialize, Deserialize)]
379pub struct SalaryComponentRef {
380 pub id: SalaryComponentId,
381}
382
383