use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use time::{OffsetDateTime, serde::timestamp::milliseconds};
#[non_exhaustive]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Data {
pub records: Vec<Record>,
}
#[non_exhaustive]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Record {
pub answers: Vec<Answer>,
pub query: String,
pub request_id: String,
#[serde(with = "milliseconds")]
pub time: OffsetDateTime,
}
#[non_exhaustive]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Answer {
#[serde(rename = "type")]
pub kind: String,
bit_set: Option<Vec<u8>>,
#[serde(flatten)]
pub payload: AnswerPayload,
}
#[non_exhaustive]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", rename_all_fields = "camelCase")]
pub enum AnswerPayload {
#[non_exhaustive]
Tts {
text: String,
},
#[non_exhaustive]
Llm {
text: String,
},
#[serde(untagged)] Unknown(Map<String, Value>),
}