use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
use super::types::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeCreatedEvent {
pub id: CompensationChangeId,
pub data: CompensationChangeDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeUpdatedEvent {
pub id: CompensationChangeId,
pub data: CompensationChangeDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompensationChangeDeletedEvent {
pub id: CompensationChangeId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntryCreatedEvent {
pub id: PayrollEntryId,
pub data: PayrollEntryDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntryUpdatedEvent {
pub id: PayrollEntryId,
pub data: PayrollEntryDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEntryDeletedEvent {
pub id: PayrollEntryId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipCreatedEvent {
pub id: SalarySlipId,
pub data: SalarySlipDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipUpdatedEvent {
pub id: SalarySlipId,
pub data: SalarySlipDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipDeletedEvent {
pub id: SalarySlipId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineCreatedEvent {
pub id: SalarySlipLineId,
pub data: SalarySlipLineDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineUpdatedEvent {
pub id: SalarySlipLineId,
pub data: SalarySlipLineDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalarySlipLineDeletedEvent {
pub id: SalarySlipLineId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureCreatedEvent {
pub id: SalaryStructureId,
pub data: SalaryStructureDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureUpdatedEvent {
pub id: SalaryStructureId,
pub data: SalaryStructureDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryStructureDeletedEvent {
pub id: SalaryStructureId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentCreatedEvent {
pub id: SalaryComponentId,
pub data: SalaryComponentDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentUpdatedEvent {
pub id: SalaryComponentId,
pub data: SalaryComponentDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SalaryComponentDeletedEvent {
pub id: SalaryComponentId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum PayrollEvent {
CompensationChangeCreated(CompensationChangeCreatedEvent),
CompensationChangeUpdated(CompensationChangeUpdatedEvent),
CompensationChangeDeleted(CompensationChangeDeletedEvent),
PayrollEntryCreated(PayrollEntryCreatedEvent),
PayrollEntryUpdated(PayrollEntryUpdatedEvent),
PayrollEntryDeleted(PayrollEntryDeletedEvent),
SalarySlipCreated(SalarySlipCreatedEvent),
SalarySlipUpdated(SalarySlipUpdatedEvent),
SalarySlipDeleted(SalarySlipDeletedEvent),
SalarySlipLineCreated(SalarySlipLineCreatedEvent),
SalarySlipLineUpdated(SalarySlipLineUpdatedEvent),
SalarySlipLineDeleted(SalarySlipLineDeletedEvent),
SalaryStructureCreated(SalaryStructureCreatedEvent),
SalaryStructureUpdated(SalaryStructureUpdatedEvent),
SalaryStructureDeleted(SalaryStructureDeletedEvent),
SalaryComponentCreated(SalaryComponentCreatedEvent),
SalaryComponentUpdated(SalaryComponentUpdatedEvent),
SalaryComponentDeleted(SalaryComponentDeletedEvent),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PayrollEventMetadata {
pub module: &'static str,
pub version: &'static str,
}
impl Default for PayrollEventMetadata {
fn default() -> Self {
Self {
module: "payroll",
version: "1.0",
}
}
}