backbone-pos 0.7.0

Point of sale — cashier session, ticket + multi-tender; orchestrates billing (revenue) + payment (settlement), posts no GL directly
Documentation
//! Public events for Pos module
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! These events are published by this module for other modules to subscribe to.
//! Events are the primary mechanism for cross-module communication.

use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};

use super::types::*;

// ============================================================================
// POSCLOSINGENTRY EVENTS
// ============================================================================

/// Event published when a PosClosingEntry is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosClosingEntryCreatedEvent {
    pub id: PosClosingEntryId,
    pub data: PosClosingEntryDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosClosingEntry is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosClosingEntryUpdatedEvent {
    pub id: PosClosingEntryId,
    pub data: PosClosingEntryDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosClosingEntry is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosClosingEntryDeletedEvent {
    pub id: PosClosingEntryId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSINVOICE EVENTS
// ============================================================================

/// Event published when a PosInvoice is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceCreatedEvent {
    pub id: PosInvoiceId,
    pub data: PosInvoiceDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosInvoice is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceUpdatedEvent {
    pub id: PosInvoiceId,
    pub data: PosInvoiceDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosInvoice is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceDeletedEvent {
    pub id: PosInvoiceId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSINVOICEITEM EVENTS
// ============================================================================

/// Event published when a PosInvoiceItem is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceItemCreatedEvent {
    pub id: PosInvoiceItemId,
    pub data: PosInvoiceItemDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosInvoiceItem is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceItemUpdatedEvent {
    pub id: PosInvoiceItemId,
    pub data: PosInvoiceItemDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosInvoiceItem is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosInvoiceItemDeletedEvent {
    pub id: PosInvoiceItemId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSPAYMENT EVENTS
// ============================================================================

/// Event published when a PosPayment is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosPaymentCreatedEvent {
    pub id: PosPaymentId,
    pub data: PosPaymentDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosPayment is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosPaymentUpdatedEvent {
    pub id: PosPaymentId,
    pub data: PosPaymentDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosPayment is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosPaymentDeletedEvent {
    pub id: PosPaymentId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSPROFILE EVENTS
// ============================================================================

/// Event published when a PosProfile is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosProfileCreatedEvent {
    pub id: PosProfileId,
    pub data: PosProfileDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosProfile is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosProfileUpdatedEvent {
    pub id: PosProfileId,
    pub data: PosProfileDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosProfile is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosProfileDeletedEvent {
    pub id: PosProfileId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSOPENINGENTRY EVENTS
// ============================================================================

/// Event published when a PosOpeningEntry is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosOpeningEntryCreatedEvent {
    pub id: PosOpeningEntryId,
    pub data: PosOpeningEntryDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosOpeningEntry is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosOpeningEntryUpdatedEvent {
    pub id: PosOpeningEntryId,
    pub data: PosOpeningEntryDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosOpeningEntry is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosOpeningEntryDeletedEvent {
    pub id: PosOpeningEntryId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSCASHMOVEMENT EVENTS
// ============================================================================

/// Event published when a PosCashMovement is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosCashMovementCreatedEvent {
    pub id: PosCashMovementId,
    pub data: PosCashMovementDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosCashMovement is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosCashMovementUpdatedEvent {
    pub id: PosCashMovementId,
    pub data: PosCashMovementDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosCashMovement is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosCashMovementDeletedEvent {
    pub id: PosCashMovementId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSDISCOUNT EVENTS
// ============================================================================

/// Event published when a PosDiscount is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosDiscountCreatedEvent {
    pub id: PosDiscountId,
    pub data: PosDiscountDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosDiscount is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosDiscountUpdatedEvent {
    pub id: PosDiscountId,
    pub data: PosDiscountDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosDiscount is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosDiscountDeletedEvent {
    pub id: PosDiscountId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSMANAGERPIN EVENTS
// ============================================================================

/// Event published when a PosManagerPin is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosManagerPinCreatedEvent {
    pub id: PosManagerPinId,
    pub data: PosManagerPinDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosManagerPin is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosManagerPinUpdatedEvent {
    pub id: PosManagerPinId,
    pub data: PosManagerPinDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosManagerPin is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosManagerPinDeletedEvent {
    pub id: PosManagerPinId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSFLOORPLAN EVENTS
// ============================================================================

/// Event published when a PosFloorPlan is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosFloorPlanCreatedEvent {
    pub id: PosFloorPlanId,
    pub data: PosFloorPlanDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosFloorPlan is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosFloorPlanUpdatedEvent {
    pub id: PosFloorPlanId,
    pub data: PosFloorPlanDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosFloorPlan is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosFloorPlanDeletedEvent {
    pub id: PosFloorPlanId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// POSTABLE EVENTS
// ============================================================================

/// Event published when a PosTable is created
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosTableCreatedEvent {
    pub id: PosTableId,
    pub data: PosTableDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosTable is updated
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosTableUpdatedEvent {
    pub id: PosTableId,
    pub data: PosTableDto,
    pub occurred_at: DateTime<Utc>,
}

/// Event published when a PosTable is deleted
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PosTableDeletedEvent {
    pub id: PosTableId,
    pub occurred_at: DateTime<Utc>,
}

// ============================================================================
// MODULE EVENT ENUM
// ============================================================================

/// All events published by Pos module
#[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),
}

/// Metadata for module events
#[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",
        }
    }
}

// ============================================================================
// CUSTOM EVENTS
// ============================================================================

// <<< CUSTOM EVENTS START >>>
// Add custom public events here
// <<< CUSTOM EVENTS END >>>