use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
use super::types::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosClosingEntryCreatedEvent {
pub id: PosClosingEntryId,
pub data: PosClosingEntryDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosClosingEntryUpdatedEvent {
pub id: PosClosingEntryId,
pub data: PosClosingEntryDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosClosingEntryDeletedEvent {
pub id: PosClosingEntryId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceCreatedEvent {
pub id: PosInvoiceId,
pub data: PosInvoiceDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceUpdatedEvent {
pub id: PosInvoiceId,
pub data: PosInvoiceDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceDeletedEvent {
pub id: PosInvoiceId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceItemCreatedEvent {
pub id: PosInvoiceItemId,
pub data: PosInvoiceItemDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceItemUpdatedEvent {
pub id: PosInvoiceItemId,
pub data: PosInvoiceItemDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceItemDeletedEvent {
pub id: PosInvoiceItemId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosPaymentCreatedEvent {
pub id: PosPaymentId,
pub data: PosPaymentDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosPaymentUpdatedEvent {
pub id: PosPaymentId,
pub data: PosPaymentDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosPaymentDeletedEvent {
pub id: PosPaymentId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosProfileCreatedEvent {
pub id: PosProfileId,
pub data: PosProfileDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosProfileUpdatedEvent {
pub id: PosProfileId,
pub data: PosProfileDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosProfileDeletedEvent {
pub id: PosProfileId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosOpeningEntryCreatedEvent {
pub id: PosOpeningEntryId,
pub data: PosOpeningEntryDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosOpeningEntryUpdatedEvent {
pub id: PosOpeningEntryId,
pub data: PosOpeningEntryDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosOpeningEntryDeletedEvent {
pub id: PosOpeningEntryId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosCashMovementCreatedEvent {
pub id: PosCashMovementId,
pub data: PosCashMovementDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosCashMovementUpdatedEvent {
pub id: PosCashMovementId,
pub data: PosCashMovementDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosCashMovementDeletedEvent {
pub id: PosCashMovementId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosDiscountCreatedEvent {
pub id: PosDiscountId,
pub data: PosDiscountDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosDiscountUpdatedEvent {
pub id: PosDiscountId,
pub data: PosDiscountDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosDiscountDeletedEvent {
pub id: PosDiscountId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosManagerPinCreatedEvent {
pub id: PosManagerPinId,
pub data: PosManagerPinDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosManagerPinUpdatedEvent {
pub id: PosManagerPinId,
pub data: PosManagerPinDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosManagerPinDeletedEvent {
pub id: PosManagerPinId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosFloorPlanCreatedEvent {
pub id: PosFloorPlanId,
pub data: PosFloorPlanDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosFloorPlanUpdatedEvent {
pub id: PosFloorPlanId,
pub data: PosFloorPlanDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosFloorPlanDeletedEvent {
pub id: PosFloorPlanId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosTableCreatedEvent {
pub id: PosTableId,
pub data: PosTableDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosTableUpdatedEvent {
pub id: PosTableId,
pub data: PosTableDto,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosTableDeletedEvent {
pub id: PosTableId,
pub occurred_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum PosEvent {
PosClosingEntryCreated(PosClosingEntryCreatedEvent),
PosClosingEntryUpdated(PosClosingEntryUpdatedEvent),
PosClosingEntryDeleted(PosClosingEntryDeletedEvent),
PosInvoiceCreated(PosInvoiceCreatedEvent),
PosInvoiceUpdated(PosInvoiceUpdatedEvent),
PosInvoiceDeleted(PosInvoiceDeletedEvent),
PosInvoiceItemCreated(PosInvoiceItemCreatedEvent),
PosInvoiceItemUpdated(PosInvoiceItemUpdatedEvent),
PosInvoiceItemDeleted(PosInvoiceItemDeletedEvent),
PosPaymentCreated(PosPaymentCreatedEvent),
PosPaymentUpdated(PosPaymentUpdatedEvent),
PosPaymentDeleted(PosPaymentDeletedEvent),
PosProfileCreated(PosProfileCreatedEvent),
PosProfileUpdated(PosProfileUpdatedEvent),
PosProfileDeleted(PosProfileDeletedEvent),
PosOpeningEntryCreated(PosOpeningEntryCreatedEvent),
PosOpeningEntryUpdated(PosOpeningEntryUpdatedEvent),
PosOpeningEntryDeleted(PosOpeningEntryDeletedEvent),
PosCashMovementCreated(PosCashMovementCreatedEvent),
PosCashMovementUpdated(PosCashMovementUpdatedEvent),
PosCashMovementDeleted(PosCashMovementDeletedEvent),
PosDiscountCreated(PosDiscountCreatedEvent),
PosDiscountUpdated(PosDiscountUpdatedEvent),
PosDiscountDeleted(PosDiscountDeletedEvent),
PosManagerPinCreated(PosManagerPinCreatedEvent),
PosManagerPinUpdated(PosManagerPinUpdatedEvent),
PosManagerPinDeleted(PosManagerPinDeletedEvent),
PosFloorPlanCreated(PosFloorPlanCreatedEvent),
PosFloorPlanUpdated(PosFloorPlanUpdatedEvent),
PosFloorPlanDeleted(PosFloorPlanDeletedEvent),
PosTableCreated(PosTableCreatedEvent),
PosTableUpdated(PosTableUpdatedEvent),
PosTableDeleted(PosTableDeletedEvent),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosEventMetadata {
pub module: &'static str,
pub version: &'static str,
}
impl Default for PosEventMetadata {
fn default() -> Self {
Self {
module: "pos",
version: "1.0",
}
}
}