use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
pub const PRODUCT_MEDIA_TYPE_V2: &str = "application/vnd.hyphae.product-v1";
pub const PRODUCT_ERROR_MEDIA_TYPE_V2: &str = "application/vnd.hyphae.error-v1";
pub const REQUEST_ID_HEADER_V2: &str = "x-hyphae-request-id";
pub const DEADLINE_HEADER_V2: &str = "x-hyphae-deadline-micros";
pub const SESSION_ID_HEADER_V2: &str = "x-hyphae-session-id";
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProductErrorLimitV2 {
pub kind: String,
pub configured: u64,
pub observed: u64,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProductErrorSourceSpanV2 {
pub start: u32,
pub end: u32,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProductErrorUnknownDetailV2 {
pub tag: u16,
pub value_hex: String,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProductErrorDetailsV2 {
pub sql_subcode: Option<String>,
pub unknown: Vec<ProductErrorUnknownDetailV2>,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProductErrorV2 {
pub code: String,
pub category: String,
pub retry: String,
pub message: String,
pub request_id: Option<String>,
pub trace_id: Option<String>,
pub object_id: Option<String>,
pub transaction_state: String,
pub transaction_id: Option<String>,
pub limit: Option<ProductErrorLimitV2>,
pub source_span: Option<ProductErrorSourceSpanV2>,
pub details: ProductErrorDetailsV2,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProvisionalDataV2 {
pub r#type: String,
pub provisional: bool,
pub sequence: usize,
pub data_base64: String,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct StreamCompletionV2 {
pub r#type: String,
pub status: String,
pub request_id: String,
pub chunks: usize,
pub response_bytes: usize,
pub digest_hex: String,
}
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct NativeV1CompatibilityPolicyV2 {
pub exact_mappings_only: bool,
pub unmappable_fails_explicitly: bool,
pub opens_format_2_state: bool,
}