use serde::Deserialize;
use std::collections::HashMap;
use super::{CommandState, Entity, FieldType, Format};
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct RequestInfo {
#[serde(rename = "@type")]
pub response_type: String,
pub statement_text: Option<String>,
pub warnings: Option<Vec<Warning>>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct CommandStatus {
pub status: CommandState,
pub message: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct Warning {
pub message: String,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Stream {
pub name: String,
pub topic: String,
pub format: Option<Format>,
#[serde(rename = "type")]
pub entity: Entity,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Table {
pub name: String,
pub topic: String,
pub format: Format,
#[serde(rename = "type")]
pub entity: Entity,
pub is_windowed: bool,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Query {
pub query_string: String,
pub sinks: String,
pub id: String,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Properties {
pub properties: Vec<Property>,
pub overwritten_properties: Vec<Property>,
pub default_properties: Vec<String>,
}
#[derive(Clone, Debug, Deserialize)]
pub struct Property {
pub name: String,
pub scope: String,
pub value: Option<String>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Description {
pub name: String,
#[serde(rename = "type")]
pub entity: Entity,
pub timestamp: String,
pub format: Option<Format>,
pub topic: String,
pub read_queries: Vec<String>,
pub write_queries: Vec<String>,
pub fields: Vec<Field>,
pub extended: bool,
pub window_type: Option<String>,
pub key_format: Option<Format>,
pub value_format: Option<Format>,
pub key: Option<String>,
pub statement: Option<String>,
pub statistics: Option<String>,
pub error_stats: Option<String>,
pub replication: Option<u32>,
pub partitions: Option<u32>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Explanation {
pub statement_text: String,
pub fields: Vec<Field>,
pub sources: Vec<String>,
pub sinks: Vec<String>,
pub execution_plan: String,
pub topology: String,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Field {
pub name: String,
pub schema: Schema,
#[serde(rename = "type")]
pub field_type: Option<String>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all(serialize = "snake_case", deserialize = "camelCase"))]
pub struct Schema {
#[serde(rename = "type")]
pub field_type: FieldType,
pub member_schema: Option<HashMap<String, Schema>>,
pub fields: Option<Vec<Field>>,
}