//! Types for WASM module communication

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// Request information passed to WASM modules
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RequestInfo {
    /// HTTP method (GET, POST, etc.)
    pub method: String,
    /// Request path
    pub path: String,
    /// Query string (without ?)
    pub query: Option<String>,
    /// Request headers
    pub headers: HashMap<String, String>,
}

/// Response information passed to WASM modules
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResponseInfo {
    /// HTTP status code
    pub status: u16,
    /// Response headers
    pub headers: HashMap<String, String>,
}

/// Action to take after module processing
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub enum ModuleAction {
    /// Continue processing (pass through)
    #[default]
    Continue,
    /// Continue with modified request/response
    Modify {
        headers: Option<HashMap<String, String>>,
        path: Option<String>,
    },
    /// Block the request with a response
    Block {
        status: u16,
        body: String,
        headers: Option<HashMap<String, String>>,
    },
}
