backbone-payroll 0.3.47

Payroll: salary structures, payroll runs and computed salary slips over effective-dated statutory tables, plus compensation changes
Documentation
//! Public types for Payroll module
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! These DTOs are the ONLY types other modules should use.
//! They are decoupled from internal domain entities.

use serde::{Deserialize, Serialize};
use uuid::Uuid;
use chrono::{DateTime, Utc, NaiveDate};
use rust_decimal::Decimal;
use crate::domain::entity::*;

// ============================================================================
// COMPENSATIONCHANGE TYPES
// ============================================================================

/// Type-safe ID for CompensationChange
///
/// Use this instead of raw Uuid for type safety across modules.
#[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
    }
}

/// Data transfer object for CompensationChange
///
/// This is the public representation of CompensationChange for other modules.
#[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,
}

/// Summary view of CompensationChange for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeSummary {
    pub id: CompensationChangeId,
}

/// Reference to CompensationChange for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeRef {
    pub id: CompensationChangeId,
}

// ============================================================================
// PAYROLLENTRY TYPES
// ============================================================================

/// Type-safe ID for PayrollEntry
///
/// Use this instead of raw Uuid for type safety across modules.
#[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
    }
}

/// Data transfer object for PayrollEntry
///
/// This is the public representation of PayrollEntry for other modules.
#[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,
}

/// Summary view of PayrollEntry for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntrySummary {
    pub id: PayrollEntryId,
    pub status: PayrollStatus,
}

/// Reference to PayrollEntry for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntryRef {
    pub id: PayrollEntryId,
}

// ============================================================================
// SALARYSLIP TYPES
// ============================================================================

/// Type-safe ID for SalarySlip
///
/// Use this instead of raw Uuid for type safety across modules.
#[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
    }
}

/// Data transfer object for SalarySlip
///
/// This is the public representation of SalarySlip for other modules.
#[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,
}

/// Summary view of SalarySlip for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipSummary {
    pub id: SalarySlipId,
}

/// Reference to SalarySlip for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipRef {
    pub id: SalarySlipId,
}

// ============================================================================
// SALARYSLIPLINE TYPES
// ============================================================================

/// Type-safe ID for SalarySlipLine
///
/// Use this instead of raw Uuid for type safety across modules.
#[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
    }
}

/// Data transfer object for SalarySlipLine
///
/// This is the public representation of SalarySlipLine for other modules.
#[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,
}

/// Summary view of SalarySlipLine for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineSummary {
    pub id: SalarySlipLineId,
    pub name: String,
}

/// Reference to SalarySlipLine for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineRef {
    pub id: SalarySlipLineId,
}

// ============================================================================
// SALARYSTRUCTURE TYPES
// ============================================================================

/// Type-safe ID for SalaryStructure
///
/// Use this instead of raw Uuid for type safety across modules.
#[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
    }
}

/// Data transfer object for SalaryStructure
///
/// This is the public representation of SalaryStructure for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureDto {
    pub id: SalaryStructureId,
    pub name: String,
    pub status: SalaryStructureStatus,
    pub metadata: serde_json::Value,
}

/// Summary view of SalaryStructure for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureSummary {
    pub id: SalaryStructureId,
    pub name: String,
    pub status: SalaryStructureStatus,
}

/// Reference to SalaryStructure for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureRef {
    pub id: SalaryStructureId,
}

// ============================================================================
// SALARYCOMPONENT TYPES
// ============================================================================

/// Type-safe ID for SalaryComponent
///
/// Use this instead of raw Uuid for type safety across modules.
#[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
    }
}

/// Data transfer object for SalaryComponent
///
/// This is the public representation of SalaryComponent for other modules.
#[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,
}

/// Summary view of SalaryComponent for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentSummary {
    pub id: SalaryComponentId,
    pub name: String,
}

/// Reference to SalaryComponent for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentRef {
    pub id: SalaryComponentId,
}

// ============================================================================
// CUSTOM TYPES
// ============================================================================

// <<< CUSTOM TYPES START >>>
// Add custom public types here
// <<< CUSTOM TYPES END >>>