use std::net::IpAddr;
use super::SrsCallbackEvent;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SrsCallbackReq {
pub server_id: String,
pub action: SrsCallbackEvent,
pub client_id: String,
pub ip: IpAddr,
pub vhost: String,
pub app: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub stream: Option<String>,
}
impl SrsCallbackReq {
#[allow(dead_code)]
#[must_use]
pub fn app_stream(&self) -> String {
if let Some(stream) = &self.stream {
format!("{}/{}", self.app, stream)
} else {
self.app.clone()
}
}
}