use serde::{Deserialize, Serialize};
use uuid::Uuid;
use chrono::{DateTime, Utc, NaiveDate};
use rust_decimal::Decimal;
use crate::domain::entity::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct CompensationChangeId(pub Uuid);
impl CompensationChangeId {
pub fn new(id: Uuid) -> Self {
Self(id)
}
pub fn into_inner(self) -> Uuid {
self.0
}
}
impl From<Uuid> for CompensationChangeId {
fn from(id: Uuid) -> Self {
Self(id)
}
}
impl From<CompensationChangeId> for Uuid {
fn from(id: CompensationChangeId) -> Self {
id.0
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeDto {
pub id: CompensationChangeId,
pub employee_id: Uuid,
pub change_type: CompensationChangeType,
pub new_amount: Option<Decimal>,
pub effective_date: Option<NaiveDate>,
pub reference_id: Option<Uuid>,
pub note: Option<String>,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeSummary {
pub id: CompensationChangeId,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeRef {
pub id: CompensationChangeId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct PayrollEntryId(pub Uuid);
impl PayrollEntryId {
pub fn new(id: Uuid) -> Self {
Self(id)
}
pub fn into_inner(self) -> Uuid {
self.0
}
}
impl From<Uuid> for PayrollEntryId {
fn from(id: Uuid) -> Self {
Self(id)
}
}
impl From<PayrollEntryId> for Uuid {
fn from(id: PayrollEntryId) -> Self {
id.0
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntryDto {
pub id: PayrollEntryId,
pub period_year: i32,
pub period_month: i32,
pub posting_date: Option<DateTime<Utc>>,
pub timesheet_approval_id: Option<Uuid>,
pub period_start: Option<NaiveDate>,
pub period_end: Option<NaiveDate>,
pub status: PayrollStatus,
pub salary_expense_account_id: Option<Uuid>,
pub salary_payable_account_id: Option<Uuid>,
pub total_gross: Decimal,
pub total_deductions: Decimal,
pub total_net: Decimal,
pub journal_id: Option<Uuid>,
pub accounting_post_id: Option<Uuid>,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntrySummary {
pub id: PayrollEntryId,
pub status: PayrollStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntryRef {
pub id: PayrollEntryId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SalarySlipId(pub Uuid);
impl SalarySlipId {
pub fn new(id: Uuid) -> Self {
Self(id)
}
pub fn into_inner(self) -> Uuid {
self.0
}
}
impl From<Uuid> for SalarySlipId {
fn from(id: Uuid) -> Self {
Self(id)
}
}
impl From<SalarySlipId> for Uuid {
fn from(id: SalarySlipId) -> Self {
id.0
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipDto {
pub id: SalarySlipId,
pub payroll_entry_id: Uuid,
pub employee_id: Uuid,
pub structure_id: Option<Uuid>,
pub working_days: Decimal,
pub unpaid_days: Decimal,
pub gross_pay: Decimal,
pub total_deductions: Decimal,
pub net_pay: Decimal,
pub overtime_hours: Option<Decimal>,
pub tax_method: Option<String>,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipSummary {
pub id: SalarySlipId,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipRef {
pub id: SalarySlipId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SalarySlipLineId(pub Uuid);
impl SalarySlipLineId {
pub fn new(id: Uuid) -> Self {
Self(id)
}
pub fn into_inner(self) -> Uuid {
self.0
}
}
impl From<Uuid> for SalarySlipLineId {
fn from(id: Uuid) -> Self {
Self(id)
}
}
impl From<SalarySlipLineId> for Uuid {
fn from(id: SalarySlipLineId) -> Self {
id.0
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineDto {
pub id: SalarySlipLineId,
pub salary_slip_id: Uuid,
pub name: String,
pub component_type: ComponentType,
pub is_statutory: bool,
pub amount: Decimal,
pub gl_account_id: Uuid,
pub source_kind: Option<String>,
pub source_ref: Option<Uuid>,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineSummary {
pub id: SalarySlipLineId,
pub name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineRef {
pub id: SalarySlipLineId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SalaryStructureId(pub Uuid);
impl SalaryStructureId {
pub fn new(id: Uuid) -> Self {
Self(id)
}
pub fn into_inner(self) -> Uuid {
self.0
}
}
impl From<Uuid> for SalaryStructureId {
fn from(id: Uuid) -> Self {
Self(id)
}
}
impl From<SalaryStructureId> for Uuid {
fn from(id: SalaryStructureId) -> Self {
id.0
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureDto {
pub id: SalaryStructureId,
pub name: String,
pub status: SalaryStructureStatus,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureSummary {
pub id: SalaryStructureId,
pub name: String,
pub status: SalaryStructureStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureRef {
pub id: SalaryStructureId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SalaryComponentId(pub Uuid);
impl SalaryComponentId {
pub fn new(id: Uuid) -> Self {
Self(id)
}
pub fn into_inner(self) -> Uuid {
self.0
}
}
impl From<Uuid> for SalaryComponentId {
fn from(id: Uuid) -> Self {
Self(id)
}
}
impl From<SalaryComponentId> for Uuid {
fn from(id: SalaryComponentId) -> Self {
id.0
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentDto {
pub id: SalaryComponentId,
pub structure_id: Uuid,
pub name: String,
pub component_type: ComponentType,
pub amount: Decimal,
pub gl_account_id: Uuid,
pub is_statutory: bool,
pub metadata: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentSummary {
pub id: SalaryComponentId,
pub name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentRef {
pub id: SalaryComponentId,
}