// This file is @generated by prost-build.
/// StreamChatRequest is a request to stream chat messages for workbook AI agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamChatRequest {
    #[prost(message, repeated, tag = "1")]
    pub messages: ::prost::alloc::vec::Vec<ModelMessage>,
    /// JSON-serialized representation of INotebook
    #[prost(string, optional, tag = "2")]
    pub notebook_as_json: ::core::option::Option<::prost::alloc::string::String>,
    /// The current tab visible in the workbook from the user's perspective
    #[prost(int32, optional, tag = "3")]
    pub selected_tab_index: ::core::option::Option<i32>,
    /// Optional: image files to provide to the agent
    #[prost(message, repeated, tag = "4")]
    pub images: ::prost::alloc::vec::Vec<ImagePart>,
}
/// ModelMessage is a discriminated union of system, user, assistant, and tool messages.
/// Each message type has its own structure and content.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelMessage {
    #[prost(oneof = "model_message::Kind", tags = "1, 2")]
    pub kind: ::core::option::Option<model_message::Kind>,
}
/// Nested message and enum types in `ModelMessage`.
pub mod model_message {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "1")]
        User(super::UserModelMessage),
        #[prost(message, tag = "2")]
        Assistant(super::AssistantModelMessage),
    }
}
/// A user message containing text
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserModelMessage {
    #[prost(message, repeated, tag = "1")]
    pub text: ::prost::alloc::vec::Vec<UserContentPart>,
}
/// An assistant message containing text
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssistantModelMessage {
    #[prost(message, repeated, tag = "1")]
    pub content_parts: ::prost::alloc::vec::Vec<AssistantContentPart>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserContentPart {
    #[prost(oneof = "user_content_part::Part", tags = "1")]
    pub part: ::core::option::Option<user_content_part::Part>,
}
/// Nested message and enum types in `UserContentPart`.
pub mod user_content_part {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Part {
        #[prost(message, tag = "1")]
        Text(super::TextPart),
    }
}
/// Content part for assistant messages: can be text, reasoning, or mutation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssistantContentPart {
    #[prost(oneof = "assistant_content_part::Part", tags = "1, 2")]
    pub part: ::core::option::Option<assistant_content_part::Part>,
}
/// Nested message and enum types in `AssistantContentPart`.
pub mod assistant_content_part {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Part {
        #[prost(message, tag = "1")]
        Text(super::TextPart),
        #[prost(message, tag = "2")]
        Reasoning(super::ReasoningPart),
    }
}
/// Text part for user or assistant messages.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextPart {
    #[prost(string, tag = "1")]
    pub text: ::prost::alloc::string::String,
}
/// User-supplied image part.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImagePart {
    /// The base64-encoded image data
    #[prost(bytes = "vec", tag = "1")]
    pub data: ::prost::alloc::vec::Vec<u8>,
    /// The media type of the image (e.g. "image/png", "image/jpeg")
    #[prost(string, optional, tag = "2")]
    pub media_type: ::core::option::Option<::prost::alloc::string::String>,
    /// Optional: the filename of the image
    #[prost(string, optional, tag = "3")]
    pub filename: ::core::option::Option<::prost::alloc::string::String>,
}
/// Reasoning part for assistant messages.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningPart {
    #[prost(string, tag = "1")]
    pub reasoning: ::prost::alloc::string::String,
}
/// StreamChatResponse is a discriminated union response to a StreamChatRequest
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamChatResponse {
    #[prost(
        oneof = "stream_chat_response::Response",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
    )]
    pub response: ::core::option::Option<stream_chat_response::Response>,
}
/// Nested message and enum types in `StreamChatResponse`.
pub mod stream_chat_response {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Response {
        #[prost(message, tag = "1")]
        Finish(super::Finish),
        #[prost(message, tag = "2")]
        Error(super::Error),
        #[prost(message, tag = "3")]
        TextStart(super::TextStart),
        #[prost(message, tag = "4")]
        TextDelta(super::TextDelta),
        #[prost(message, tag = "5")]
        TextEnd(super::TextEnd),
        #[prost(message, tag = "6")]
        ReasoningStart(super::ReasoningStart),
        #[prost(message, tag = "7")]
        ReasoningDelta(super::ReasoningDelta),
        #[prost(message, tag = "8")]
        ReasoningEnd(super::ReasoningEnd),
        #[prost(message, tag = "9")]
        WorkbookMutation(super::WorkbookMutation),
        #[prost(message, tag = "10")]
        ToolAction(super::ToolAction),
    }
}
/// Indicates the end of a chat session
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Finish {}
/// An error that occurred during the chat session
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
    #[prost(string, tag = "1")]
    pub message: ::prost::alloc::string::String,
}
/// Indicates the start of a text message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextStart {
    /// uniquely identifies the text message (e.g. uuid) so that the client can
    /// merge parallel message streams (if it happens).
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// A delta (continuation) of a text message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextDelta {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The next chunk of text
    #[prost(string, tag = "2")]
    pub delta: ::prost::alloc::string::String,
}
/// Indicates the end of a text message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextEnd {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// Indicates the start of a reasoning message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningStart {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// A delta (continuation) of a reasoning message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningDelta {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The next chunk of reasoning
    #[prost(string, tag = "2")]
    pub delta: ::prost::alloc::string::String,
}
/// Indicates the end of a reasoning message from the agent
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningEnd {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// Add a new tab to the workbook
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddTabMutation {
    /// if tab_name is not provided, we'll name it "New Tab"
    #[prost(string, optional, tag = "1")]
    pub tab_name: ::core::option::Option<::prost::alloc::string::String>,
}
/// this is the "result" of the mutation
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddOrUpdatePanelMutation {
    /// JSON-serialized representation of IVizDefinition
    #[prost(string, tag = "1")]
    pub panel_as_json: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub panel_id: ::prost::alloc::string::String,
    #[prost(int32, tag = "3")]
    pub tab_index: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemovePanelsMutation {
    #[prost(string, repeated, tag = "1")]
    pub panel_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// AddOrReplaceVariableMutation is a mutation to add or replace a variable in the workbook
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddOrReplaceVariableMutation {
    /// scout_compute_api_ComputeSpecWithContext (this needs to be resolved)
    /// be careful: this uses the scout_compute_api version of ComputeSpecWithContext, which stores the spec as "seriesNode"
    /// and is NOT the same as ComputeSpecWithContext that is stored in INotebook.
    #[prost(string, tag = "1")]
    pub compute_spec_as_json: ::prost::alloc::string::String,
    /// if variable_name is not provided, we'll assume it's a new variable and auto-generate a unique name
    #[prost(string, optional, tag = "2")]
    pub variable_name: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "3")]
    pub display_name: ::core::option::Option<::prost::alloc::string::String>,
}
/// DeleteVariablesMutation is a mutation to delete variables from the workbook
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteVariablesMutation {
    #[prost(string, repeated, tag = "1")]
    pub variable_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// WorkbookMutation is a mutation to the workbook
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkbookMutation {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(oneof = "workbook_mutation::Mutation", tags = "2, 3, 4, 5, 6")]
    pub mutation: ::core::option::Option<workbook_mutation::Mutation>,
}
/// Nested message and enum types in `WorkbookMutation`.
pub mod workbook_mutation {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Mutation {
        #[prost(message, tag = "2")]
        AddTab(super::AddTabMutation),
        #[prost(message, tag = "3")]
        AddOrUpdatePanel(super::AddOrUpdatePanelMutation),
        #[prost(message, tag = "4")]
        RemovePanels(super::RemovePanelsMutation),
        #[prost(message, tag = "5")]
        AddOrReplaceVariable(super::AddOrReplaceVariableMutation),
        #[prost(message, tag = "6")]
        DeleteVariables(super::DeleteVariablesMutation),
    }
}
/// this is a concise descirption of a tool call that the agent is making internally
/// without revealing too much detail about the tool call, it informs the user what the agent is doing
/// at a high level. the format is: `{tool_action_verb} {tool_target}` for example:
/// "Search channels for My Datasource"
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolAction {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// "Thought", "Read", "Find", "Look-up", etc.
    #[prost(string, tag = "2")]
    pub tool_action_verb: ::prost::alloc::string::String,
    /// "workbook", "channel", "variable", "panel", etc.
    #[prost(string, optional, tag = "3")]
    pub tool_target: ::core::option::Option<::prost::alloc::string::String>,
}
/// Generated client implementations.
pub mod workbook_agent_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// WorkbookAgentService provides AI-powered assistance for workbook operations
    #[derive(Debug, Clone)]
    pub struct WorkbookAgentServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl WorkbookAgentServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> WorkbookAgentServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> WorkbookAgentServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            WorkbookAgentServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// StreamChat handles bidirectional streaming chat for workbook AI agent
        pub async fn stream_chat(
            &mut self,
            request: impl tonic::IntoRequest<super::StreamChatRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::StreamChatResponse>>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.WorkbookAgentService/StreamChat",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.ai.v1.WorkbookAgentService", "StreamChat"),
                );
            self.inner.server_streaming(req, path, codec).await
        }
    }
}
/// CreateOrUpdateKnowledgeBaseRequest is a request to create a knowledge from an attachment in the attachment's
/// workspace. Subsequent calls for the same attachment will overwrite the existing knowledge base.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOrUpdateKnowledgeBaseRequest {
    #[prost(string, tag = "1")]
    pub attachment_rid: ::prost::alloc::string::String,
    /// summary of the knowledge base, will be used by the LLM to decide when to use it
    #[prost(string, tag = "2")]
    pub summary_description: ::prost::alloc::string::String,
    #[prost(enumeration = "KnowledgeBaseType", tag = "3")]
    pub r#type: i32,
}
/// CreateOrUpdateKnowledgeBaseResponse is the response to creating/updating a knowledge base
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOrUpdateKnowledgeBaseResponse {
    #[prost(string, tag = "1")]
    pub knowledge_base_rid: ::prost::alloc::string::String,
}
/// KnowledgeBaseType defines the types of knowledge base
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum KnowledgeBaseType {
    /// defaults to PROMPT
    Unspecified = 0,
    /// knowledge base gets added directly to prompt (needs to be small enough!)
    Prompt = 1,
    /// knowledge base gets used via vector search on embeddings
    Embedding = 2,
}
impl KnowledgeBaseType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "KNOWLEDGE_BASE_TYPE_UNSPECIFIED",
            Self::Prompt => "KNOWLEDGE_BASE_TYPE_PROMPT",
            Self::Embedding => "KNOWLEDGE_BASE_TYPE_EMBEDDING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "KNOWLEDGE_BASE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "KNOWLEDGE_BASE_TYPE_PROMPT" => Some(Self::Prompt),
            "KNOWLEDGE_BASE_TYPE_EMBEDDING" => Some(Self::Embedding),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod knowledge_base_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// KnowledgeBaseService provides AI-powered knowledge base management
    #[derive(Debug, Clone)]
    pub struct KnowledgeBaseServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl KnowledgeBaseServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> KnowledgeBaseServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> KnowledgeBaseServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            KnowledgeBaseServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// CreateOrUpdateKnowledgeBase creates a knowledge base in the workspace
        pub async fn create_or_update_knowledge_base(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateOrUpdateKnowledgeBaseRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateOrUpdateKnowledgeBaseResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.ai.v1.KnowledgeBaseService/CreateOrUpdateKnowledgeBase",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.ai.v1.KnowledgeBaseService",
                        "CreateOrUpdateKnowledgeBase",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
