use std::collections::HashMap;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RegisterRequest {
pub name: String,
pub routes: Vec<RouteRegistration>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RouteRegistration {
pub method: String,
pub path: String,
#[serde(default)]
pub sse: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RegisterResponse {
pub worker_id: String,
pub shm_name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkerEvent {
pub source: String,
pub event_type: String,
pub data: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HubEvent {
pub source: String,
pub event_type: String,
pub data: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HealthResponse {
pub ok: bool,
pub workers: Vec<WorkerInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkerInfo {
pub name: String,
pub worker_id: String,
pub route_count: usize,
pub transport: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SsePushRequest {
#[serde(default)]
pub path: Option<String>,
#[serde(default)]
pub pattern: Option<String>,
#[serde(default)]
pub params: Option<HashMap<String, String>>,
pub event_type: String,
pub data: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SseLifecycle {
pub sse_lifecycle: String,
pub params: HashMap<String, String>,
}