//! Order event types
//!
//! Event types for the complete order lifecycle.

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

use super::{OrderId, OrderSide, OrderType, Price, Quantity, Symbol};

// =============================================================================
// Event Types - Moved from trading_engine to enforce pure client architecture
// =============================================================================

/// Order events for the complete order lifecycle
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OrderEvent {
    /// Unique identifier for the order
    pub order_id: OrderId,
    /// Trading symbol for the order
    pub symbol: Symbol,
    /// Type of order (market, limit, stop, etc.)
    pub order_type: OrderType,
    /// Order side (buy or sell)
    pub side: OrderSide,
    /// Order quantity
    pub quantity: Quantity,
    /// Order price (None for market orders)
    pub price: Option<Price>,
    /// Timestamp when the event occurred
    pub timestamp: DateTime<Utc>,
    /// Strategy or client identifier
    pub strategy_id: String,
    /// Order event type (placed, modified, cancelled)
    pub event_type: OrderEventType,
    /// Previous quantity for modifications
    pub previous_quantity: Option<Quantity>,
    /// Previous price for modifications
    pub previous_price: Option<Price>,
    /// Reason for cancellation or modification
    pub reason: Option<String>,
}

/// Types of order events
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum OrderEventType {
    /// Order was placed
    Placed,
    /// Order was modified
    Modified,
    /// Order was cancelled
    Cancelled,
    /// Order was rejected
    Rejected,
}
