// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateConversationRequest {
    #[prost(string, tag = "1")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workbook_rid: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub message: ::core::option::Option<ModelMessage>,
    #[prost(string, optional, tag = "4")]
    pub title: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateConversationResponse {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListConversationsRequest {
    #[prost(string, tag = "1")]
    pub workbook_rid: ::prost::alloc::string::String,
    /// (default 10)
    #[prost(int32, optional, tag = "2")]
    pub limit: ::core::option::Option<i32>,
    /// (default empty)
    #[prost(string, optional, tag = "3")]
    pub cursor: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListConversationsResponse {
    #[prost(message, repeated, tag = "1")]
    pub conversations: ::prost::alloc::vec::Vec<ConversationMetadata>,
    /// Next cursor for pagination
    #[prost(string, optional, tag = "2")]
    pub next_cursor: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationResponse {
    #[prost(message, optional, tag = "1")]
    pub conversation: ::core::option::Option<Conversation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddMessageRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub message: ::core::option::Option<ModelMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddMessageResponse {
    /// Confirmation of the message being added
    #[prost(string, tag = "1")]
    pub message_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetConversationTitleRequest {
    #[prost(string, tag = "1")]
    pub conversation_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub title: ::prost::alloc::string::String,
}
/// Empty response
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SetConversationTitleResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConversationMetadata {
    /// Conversation rid
    #[prost(string, tag = "1")]
    pub rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workbook_rid: ::prost::alloc::string::String,
    /// LLM-generated or user-set title
    #[prost(string, tag = "3")]
    pub title: ::prost::alloc::string::String,
    /// Creation timestamp
    #[prost(message, optional, tag = "4")]
    pub created_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    /// Last updated timestamp
    #[prost(message, optional, tag = "5")]
    pub updated_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
}
/// ModelMessage is a discriminated union of user and assistant messages.
/// Each message type has its own structure and content.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelMessage {
    /// UUID - allows us to restart or resume a conversation from a given message
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// Timestamp when the message was created
    #[prost(message, optional, tag = "2")]
    pub created_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(oneof = "model_message::Kind", tags = "3, 4")]
    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 = "3")]
        User(super::UserModelMessage),
        #[prost(message, tag = "4")]
        Assistant(super::AssistantModelMessage),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Conversation {
    #[prost(message, optional, tag = "1")]
    pub metadata: ::core::option::Option<ConversationMetadata>,
    #[prost(message, repeated, tag = "2")]
    pub messages: ::prost::alloc::vec::Vec<ModelMessage>,
}
/// A user message containing text and optional context
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserModelMessage {
    #[prost(message, repeated, tag = "1")]
    pub parts: ::prost::alloc::vec::Vec<UserContentPart>,
}
/// An assistant message containing text and reasoning
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssistantModelMessage {
    #[prost(message, repeated, tag = "1")]
    pub parts: ::prost::alloc::vec::Vec<AssistantContentPart>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserContentPart {
    #[prost(oneof = "user_content_part::Part", tags = "1, 2")]
    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),
        #[prost(message, tag = "2")]
        Image(super::ImagePart),
    }
}
/// Content part for assistant messages: can be text or reasoning.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssistantContentPart {
    #[prost(oneof = "assistant_content_part::Part", tags = "1, 2, 3")]
    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),
        #[prost(message, tag = "3")]
        ToolAction(super::ToolActionPart),
    }
}
/// 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 {
    #[prost(string, tag = "1")]
    pub s3_uri: ::prost::alloc::string::String,
    /// 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>,
}
/// Reasoning part for assistant messages.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningPart {
    #[prost(string, tag = "1")]
    pub reasoning: ::prost::alloc::string::String,
}
/// Tool action part for assistant messages.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolActionPart {
    #[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 conversation_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// ConversationService provides conversation lifecycle and persistence for AI agents
    #[derive(Debug, Clone)]
    pub struct ConversationServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ConversationServiceClient<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> ConversationServiceClient<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,
        ) -> ConversationServiceClient<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,
        {
            ConversationServiceClient::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
        }
        /// Create a new conversation for any agent type
        pub async fn create_conversation(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateConversationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateConversationResponse>,
            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.conversations.v1.ConversationService/CreateConversation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.conversations.v1.ConversationService",
                        "CreateConversation",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// List latest conversations for a context in descending order of updated_at timestamp
        pub async fn list_conversations(
            &mut self,
            request: impl tonic::IntoRequest<super::ListConversationsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListConversationsResponse>,
            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.conversations.v1.ConversationService/ListConversations",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.conversations.v1.ConversationService",
                        "ListConversations",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Get conversation by rid including full message history
        pub async fn get_conversation(
            &mut self,
            request: impl tonic::IntoRequest<super::GetConversationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetConversationResponse>,
            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.conversations.v1.ConversationService/GetConversation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.conversations.v1.ConversationService",
                        "GetConversation",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Add a message to an existing conversation
        pub async fn add_message(
            &mut self,
            request: impl tonic::IntoRequest<super::AddMessageRequest>,
        ) -> std::result::Result<
            tonic::Response<super::AddMessageResponse>,
            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.conversations.v1.ConversationService/AddMessage",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.conversations.v1.ConversationService",
                        "AddMessage",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Set or update the title of a conversation
        pub async fn set_conversation_title(
            &mut self,
            request: impl tonic::IntoRequest<super::SetConversationTitleRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SetConversationTitleResponse>,
            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.conversations.v1.ConversationService/SetConversationTitle",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.conversations.v1.ConversationService",
                        "SetConversationTitle",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
