use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct ExportedDecisionRow {
pub request_id: String,
pub session_id: Option<String>,
pub organization_id: String,
pub provider: Option<String>,
pub model: Option<String>,
pub status: String,
pub latency_ms: Option<i64>,
pub cost_micro_usd: Option<i64>,
pub cache_enabled: Option<bool>,
pub threat: Option<String>,
pub created_at: String,
}
#[derive(Debug, Clone, Deserialize)]
pub struct ExportTrailer {
pub rows_emitted: i64,
pub truncated: bool,
pub reason: Option<String>,
}
#[derive(Debug, Clone)]
pub struct ExportDecisionsParams {
pub from: String,
pub to: String,
pub format: Option<String>,
}
impl ExportDecisionsParams {
#[must_use]
pub fn new(from: impl Into<String>, to: impl Into<String>) -> Self {
Self {
from: from.into(),
to: to.into(),
format: None,
}
}
pub(crate) fn query(&self) -> Vec<(String, String)> {
let mut q = vec![
("from".to_owned(), self.from.clone()),
("to".to_owned(), self.to.clone()),
];
if let Some(f) = &self.format {
q.push(("format".to_owned(), f.clone()));
}
q
}
}