// This file is @generated by prost-build.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct StartTrainingRequest {
    /// e.g., "TLOB", "MAMBA_2", "DQN", "PPO"
    #[prost(string, tag = "1")]
    pub model_type: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub data_source: ::core::option::Option<DataSource>,
    #[prost(message, optional, tag = "3")]
    pub hyperparameters: ::core::option::Option<Hyperparameters>,
    #[prost(bool, tag = "4")]
    pub use_gpu: bool,
    /// Optional user-provided description for the job.
    #[prost(string, tag = "5")]
    pub description: ::prost::alloc::string::String,
    /// Optional tags for categorizing jobs
    #[prost(map = "string, string", tag = "6")]
    pub tags: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct StartTrainingResponse {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
    #[prost(enumeration = "TrainingStatus", tag = "2")]
    pub status: i32,
    #[prost(string, tag = "3")]
    pub message: ::prost::alloc::string::String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct SubscribeToTrainingStatusRequest {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
}
/// A single status update message streamed from the server.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct TrainingStatusUpdate {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
    #[prost(enumeration = "TrainingStatus", tag = "2")]
    pub status: i32,
    /// e.g., 75.5 for 75.5%
    #[prost(float, tag = "3")]
    pub progress_percentage: f32,
    #[prost(uint32, tag = "4")]
    pub current_epoch: u32,
    #[prost(uint32, tag = "5")]
    pub total_epochs: u32,
    /// e.g., "loss", "accuracy", "sharpe_ratio"
    #[prost(map = "string, float", tag = "6")]
    pub metrics: ::std::collections::HashMap<::prost::alloc::string::String, f32>,
    /// e.g., "Epoch 10/100 completed", "Error: CUDA out of memory"
    #[prost(string, tag = "7")]
    pub message: ::prost::alloc::string::String,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "8")]
    pub timestamp: i64,
    #[prost(message, optional, tag = "9")]
    pub financial_metrics: ::core::option::Option<FinancialMetrics>,
    #[prost(message, optional, tag = "10")]
    pub resource_usage: ::core::option::Option<ResourceUsage>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct StopTrainingRequest {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
    /// Optional reason for stopping
    #[prost(string, tag = "2")]
    pub reason: ::prost::alloc::string::String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct StopTrainingResponse {
    #[prost(bool, tag = "1")]
    pub success: bool,
    #[prost(string, tag = "2")]
    pub message: ::prost::alloc::string::String,
}
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct ListAvailableModelsRequest {}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct ListAvailableModelsResponse {
    #[prost(message, repeated, tag = "1")]
    pub models: ::prost::alloc::vec::Vec<ModelDefinition>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct ListTrainingJobsRequest {
    #[prost(uint32, tag = "1")]
    pub page: u32,
    #[prost(uint32, tag = "2")]
    pub page_size: u32,
    #[prost(enumeration = "TrainingStatus", tag = "3")]
    pub status_filter: i32,
    #[prost(string, tag = "4")]
    pub model_type_filter: ::prost::alloc::string::String,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "5")]
    pub start_time: i64,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "6")]
    pub end_time: i64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct ListTrainingJobsResponse {
    #[prost(message, repeated, tag = "1")]
    pub jobs: ::prost::alloc::vec::Vec<TrainingJobSummary>,
    #[prost(uint32, tag = "2")]
    pub total_count: u32,
    #[prost(uint32, tag = "3")]
    pub page: u32,
    #[prost(uint32, tag = "4")]
    pub page_size: u32,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct GetTrainingJobDetailsRequest {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct GetTrainingJobDetailsResponse {
    #[prost(message, optional, tag = "1")]
    pub job_details: ::core::option::Option<TrainingJobDetails>,
}
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct HealthCheckRequest {}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct HealthCheckResponse {
    #[prost(bool, tag = "1")]
    pub healthy: bool,
    #[prost(string, tag = "2")]
    pub message: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "3")]
    pub details: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct DataSource {
    /// Unix timestamp in seconds
    #[prost(int64, tag = "4")]
    pub start_time: i64,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "5")]
    pub end_time: i64,
    #[prost(oneof = "data_source::Source", tags = "1, 2, 3")]
    pub source: ::core::option::Option<data_source::Source>,
}
/// Nested message and enum types in `DataSource`.
pub mod data_source {
    #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Oneof)]
    pub enum Source {
        #[prost(string, tag = "1")]
        HistoricalDbQuery(::prost::alloc::string::String),
        #[prost(string, tag = "2")]
        RealTimeStreamTopic(::prost::alloc::string::String),
        #[prost(string, tag = "3")]
        FilePath(::prost::alloc::string::String),
    }
}
/// Provides type-safe hyperparameter configuration.
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct Hyperparameters {
    #[prost(oneof = "hyperparameters::ModelParams", tags = "1, 2, 3, 4, 5, 6")]
    pub model_params: ::core::option::Option<hyperparameters::ModelParams>,
}
/// Nested message and enum types in `Hyperparameters`.
pub mod hyperparameters {
    #[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Oneof)]
    pub enum ModelParams {
        #[prost(message, tag = "1")]
        TlobParams(super::TlobParams),
        #[prost(message, tag = "2")]
        MambaParams(super::MambaParams),
        #[prost(message, tag = "3")]
        DqnParams(super::DqnParams),
        #[prost(message, tag = "4")]
        PpoParams(super::PpoParams),
        #[prost(message, tag = "5")]
        LiquidParams(super::LiquidParams),
        #[prost(message, tag = "6")]
        TftParams(super::TftParams),
    }
}
/// TLOB (Time-Limit `Order` Book) Transformer parameters
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct TlobParams {
    #[prost(uint32, tag = "1")]
    pub epochs: u32,
    #[prost(float, tag = "2")]
    pub learning_rate: f32,
    #[prost(uint32, tag = "3")]
    pub batch_size: u32,
    #[prost(uint32, tag = "4")]
    pub sequence_length: u32,
    #[prost(uint32, tag = "5")]
    pub hidden_dim: u32,
    #[prost(uint32, tag = "6")]
    pub num_heads: u32,
    #[prost(uint32, tag = "7")]
    pub num_layers: u32,
    #[prost(float, tag = "8")]
    pub dropout_rate: f32,
    #[prost(bool, tag = "9")]
    pub use_positional_encoding: bool,
}
/// MAMBA-2 State Space Model parameters
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct MambaParams {
    #[prost(uint32, tag = "1")]
    pub epochs: u32,
    #[prost(float, tag = "2")]
    pub learning_rate: f32,
    #[prost(uint32, tag = "3")]
    pub batch_size: u32,
    #[prost(uint32, tag = "4")]
    pub state_dim: u32,
    #[prost(uint32, tag = "5")]
    pub hidden_dim: u32,
    #[prost(uint32, tag = "6")]
    pub num_layers: u32,
    #[prost(float, tag = "7")]
    pub dt_min: f32,
    #[prost(float, tag = "8")]
    pub dt_max: f32,
    #[prost(bool, tag = "9")]
    pub use_cuda_kernels: bool,
}
/// DQN (Deep Q-Network) parameters
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct DqnParams {
    #[prost(uint32, tag = "1")]
    pub epochs: u32,
    #[prost(float, tag = "2")]
    pub learning_rate: f32,
    #[prost(uint32, tag = "3")]
    pub batch_size: u32,
    #[prost(uint32, tag = "4")]
    pub replay_buffer_size: u32,
    #[prost(float, tag = "5")]
    pub epsilon_start: f32,
    #[prost(float, tag = "6")]
    pub epsilon_end: f32,
    #[prost(uint32, tag = "7")]
    pub epsilon_decay_steps: u32,
    #[prost(float, tag = "8")]
    pub gamma: f32,
    #[prost(uint32, tag = "9")]
    pub target_update_frequency: u32,
    #[prost(bool, tag = "10")]
    pub use_double_dqn: bool,
    #[prost(bool, tag = "11")]
    pub use_dueling: bool,
    #[prost(bool, tag = "12")]
    pub use_prioritized_replay: bool,
}
/// PPO (Proximal Policy Optimization) parameters
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct PpoParams {
    #[prost(uint32, tag = "1")]
    pub epochs: u32,
    #[prost(float, tag = "2")]
    pub learning_rate: f32,
    #[prost(uint32, tag = "3")]
    pub batch_size: u32,
    #[prost(float, tag = "4")]
    pub clip_ratio: f32,
    #[prost(float, tag = "5")]
    pub value_loss_coef: f32,
    #[prost(float, tag = "6")]
    pub entropy_coef: f32,
    #[prost(uint32, tag = "7")]
    pub rollout_steps: u32,
    #[prost(uint32, tag = "8")]
    pub minibatch_size: u32,
    #[prost(float, tag = "9")]
    pub gae_lambda: f32,
}
/// Liquid Network parameters
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct LiquidParams {
    #[prost(uint32, tag = "1")]
    pub epochs: u32,
    #[prost(float, tag = "2")]
    pub learning_rate: f32,
    #[prost(uint32, tag = "3")]
    pub batch_size: u32,
    #[prost(uint32, tag = "4")]
    pub num_neurons: u32,
    #[prost(float, tag = "5")]
    pub tau: f32,
    #[prost(float, tag = "6")]
    pub sigma: f32,
    #[prost(bool, tag = "7")]
    pub use_adaptive_tau: bool,
}
/// Temporal Fusion Transformer parameters
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct TftParams {
    #[prost(uint32, tag = "1")]
    pub epochs: u32,
    #[prost(float, tag = "2")]
    pub learning_rate: f32,
    #[prost(uint32, tag = "3")]
    pub batch_size: u32,
    #[prost(uint32, tag = "4")]
    pub hidden_dim: u32,
    #[prost(uint32, tag = "5")]
    pub num_heads: u32,
    #[prost(uint32, tag = "6")]
    pub num_layers: u32,
    #[prost(uint32, tag = "7")]
    pub lookback_window: u32,
    #[prost(uint32, tag = "8")]
    pub forecast_horizon: u32,
    #[prost(float, tag = "9")]
    pub dropout_rate: f32,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct ModelDefinition {
    #[prost(string, tag = "1")]
    pub model_type: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub description: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub default_hyperparameters: ::core::option::Option<Hyperparameters>,
    #[prost(string, repeated, tag = "4")]
    pub required_features: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(uint32, tag = "5")]
    pub estimated_training_time_minutes: u32,
    #[prost(bool, tag = "6")]
    pub requires_gpu: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct TrainingJobSummary {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub model_type: ::prost::alloc::string::String,
    #[prost(enumeration = "TrainingStatus", tag = "3")]
    pub status: i32,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "4")]
    pub created_at: i64,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "5")]
    pub started_at: i64,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "6")]
    pub completed_at: i64,
    #[prost(string, tag = "7")]
    pub description: ::prost::alloc::string::String,
    #[prost(float, tag = "8")]
    pub final_loss: f32,
    #[prost(float, tag = "9")]
    pub best_validation_score: f32,
    #[prost(map = "string, string", tag = "10")]
    pub tags: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct TrainingJobDetails {
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub model_type: ::prost::alloc::string::String,
    #[prost(enumeration = "TrainingStatus", tag = "3")]
    pub status: i32,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "4")]
    pub created_at: i64,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "5")]
    pub started_at: i64,
    /// Unix timestamp in seconds
    #[prost(int64, tag = "6")]
    pub completed_at: i64,
    #[prost(string, tag = "7")]
    pub description: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "8")]
    pub hyperparameters: ::core::option::Option<Hyperparameters>,
    #[prost(message, optional, tag = "9")]
    pub data_source: ::core::option::Option<DataSource>,
    #[prost(message, repeated, tag = "10")]
    pub status_history: ::prost::alloc::vec::Vec<TrainingStatusUpdate>,
    #[prost(message, optional, tag = "11")]
    pub final_financial_metrics: ::core::option::Option<FinancialMetrics>,
    #[prost(string, tag = "12")]
    pub model_artifact_path: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "13")]
    pub tags: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    #[prost(string, tag = "14")]
    pub error_message: ::prost::alloc::string::String,
}
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct FinancialMetrics {
    #[prost(float, tag = "1")]
    pub simulated_return: f32,
    #[prost(float, tag = "2")]
    pub sharpe_ratio: f32,
    #[prost(float, tag = "3")]
    pub max_drawdown: f32,
    #[prost(float, tag = "4")]
    pub hit_rate: f32,
    #[prost(float, tag = "5")]
    pub avg_prediction_error_bps: f32,
    #[prost(float, tag = "6")]
    pub risk_adjusted_return: f32,
    #[prost(float, tag = "7")]
    pub var_5pct: f32,
    #[prost(float, tag = "8")]
    pub expected_shortfall: f32,
}
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize, ::prost::Message)]
pub struct ResourceUsage {
    #[prost(float, tag = "1")]
    pub cpu_usage_percent: f32,
    #[prost(float, tag = "2")]
    pub memory_usage_gb: f32,
    #[prost(float, tag = "3")]
    pub gpu_usage_percent: f32,
    #[prost(float, tag = "4")]
    pub gpu_memory_usage_gb: f32,
    #[prost(uint32, tag = "5")]
    pub active_workers: u32,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize, ::prost::Enumeration)]
#[repr(i32)]
pub enum TrainingStatus {
    Unknown = 0,
    Pending = 1,
    Running = 2,
    Completed = 3,
    Failed = 4,
    Stopped = 5,
    Paused = 6,
}
impl TrainingStatus {
    /// 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::Unknown => "UNKNOWN",
            Self::Pending => "PENDING",
            Self::Running => "RUNNING",
            Self::Completed => "COMPLETED",
            Self::Failed => "FAILED",
            Self::Stopped => "STOPPED",
            Self::Paused => "PAUSED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UNKNOWN" => Some(Self::Unknown),
            "PENDING" => Some(Self::Pending),
            "RUNNING" => Some(Self::Running),
            "COMPLETED" => Some(Self::Completed),
            "FAILED" => Some(Self::Failed),
            "STOPPED" => Some(Self::Stopped),
            "PAUSED" => Some(Self::Paused),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod ml_training_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// The main ML Training Service
    #[derive(Debug, Clone)]
    pub struct MlTrainingServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl MlTrainingServiceClient<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> MlTrainingServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        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,
        ) -> MlTrainingServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            MlTrainingServiceClient::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
        }
        /// Initiates a training job. Returns a job_id immediately.
        pub async fn start_training(
            &mut self,
            request: impl tonic::IntoRequest<super::StartTrainingRequest>,
        ) -> std::result::Result<
            tonic::Response<super::StartTrainingResponse>,
            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(
                "/ml_training.MLTrainingService/StartTraining",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("ml_training.MLTrainingService", "StartTraining"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Subscribes to real-time status updates for a specific job.
        ///
        /// The server will stream updates as they happen until the job completes or the client disconnects.
        pub async fn subscribe_to_training_status(
            &mut self,
            request: impl tonic::IntoRequest<super::SubscribeToTrainingStatusRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::TrainingStatusUpdate>>,
            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(
                "/ml_training.MLTrainingService/SubscribeToTrainingStatus",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "ml_training.MLTrainingService",
                        "SubscribeToTrainingStatus",
                    ),
                );
            self.inner.server_streaming(req, path, codec).await
        }
        /// Stops a running training job. This is an idempotent operation.
        pub async fn stop_training(
            &mut self,
            request: impl tonic::IntoRequest<super::StopTrainingRequest>,
        ) -> std::result::Result<
            tonic::Response<super::StopTrainingResponse>,
            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(
                "/ml_training.MLTrainingService/StopTraining",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("ml_training.MLTrainingService", "StopTraining"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Lists models available for training and their default parameter templates.
        pub async fn list_available_models(
            &mut self,
            request: impl tonic::IntoRequest<super::ListAvailableModelsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListAvailableModelsResponse>,
            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(
                "/ml_training.MLTrainingService/ListAvailableModels",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "ml_training.MLTrainingService",
                        "ListAvailableModels",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Fetches a paginated list of historical training jobs.
        pub async fn list_training_jobs(
            &mut self,
            request: impl tonic::IntoRequest<super::ListTrainingJobsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListTrainingJobsResponse>,
            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(
                "/ml_training.MLTrainingService/ListTrainingJobs",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("ml_training.MLTrainingService", "ListTrainingJobs"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Get detailed information about a specific training job.
        pub async fn get_training_job_details(
            &mut self,
            request: impl tonic::IntoRequest<super::GetTrainingJobDetailsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetTrainingJobDetailsResponse>,
            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(
                "/ml_training.MLTrainingService/GetTrainingJobDetails",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "ml_training.MLTrainingService",
                        "GetTrainingJobDetails",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Health check for the service
        pub async fn health_check(
            &mut self,
            request: impl tonic::IntoRequest<super::HealthCheckRequest>,
        ) -> std::result::Result<
            tonic::Response<super::HealthCheckResponse>,
            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(
                "/ml_training.MLTrainingService/HealthCheck",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("ml_training.MLTrainingService", "HealthCheck"));
            self.inner.unary(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod ml_training_service_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with MlTrainingServiceServer.
    #[async_trait]
    pub trait MlTrainingService: std::marker::Send + std::marker::Sync + 'static {
        /// Initiates a training job. Returns a job_id immediately.
        async fn start_training(
            &self,
            request: tonic::Request<super::StartTrainingRequest>,
        ) -> std::result::Result<
            tonic::Response<super::StartTrainingResponse>,
            tonic::Status,
        >;
        /// Server streaming response type for the SubscribeToTrainingStatus method.
        type SubscribeToTrainingStatusStream: tonic::codegen::tokio_stream::Stream<
                Item = std::result::Result<super::TrainingStatusUpdate, tonic::Status>,
            >
            + std::marker::Send
            + 'static;
        /// Subscribes to real-time status updates for a specific job.
        ///
        /// The server will stream updates as they happen until the job completes or the client disconnects.
        async fn subscribe_to_training_status(
            &self,
            request: tonic::Request<super::SubscribeToTrainingStatusRequest>,
        ) -> std::result::Result<
            tonic::Response<Self::SubscribeToTrainingStatusStream>,
            tonic::Status,
        >;
        /// Stops a running training job. This is an idempotent operation.
        async fn stop_training(
            &self,
            request: tonic::Request<super::StopTrainingRequest>,
        ) -> std::result::Result<
            tonic::Response<super::StopTrainingResponse>,
            tonic::Status,
        >;
        /// Lists models available for training and their default parameter templates.
        async fn list_available_models(
            &self,
            request: tonic::Request<super::ListAvailableModelsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListAvailableModelsResponse>,
            tonic::Status,
        >;
        /// Fetches a paginated list of historical training jobs.
        async fn list_training_jobs(
            &self,
            request: tonic::Request<super::ListTrainingJobsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListTrainingJobsResponse>,
            tonic::Status,
        >;
        /// Get detailed information about a specific training job.
        async fn get_training_job_details(
            &self,
            request: tonic::Request<super::GetTrainingJobDetailsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetTrainingJobDetailsResponse>,
            tonic::Status,
        >;
        /// Health check for the service
        async fn health_check(
            &self,
            request: tonic::Request<super::HealthCheckRequest>,
        ) -> std::result::Result<
            tonic::Response<super::HealthCheckResponse>,
            tonic::Status,
        >;
    }
    /// The main ML Training Service
    #[derive(Debug)]
    pub struct MlTrainingServiceServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> MlTrainingServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(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.max_decoding_message_size = Some(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.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for MlTrainingServiceServer<T>
    where
        T: MlTrainingService,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::BoxBody>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/ml_training.MLTrainingService/StartTraining" => {
                    #[allow(non_camel_case_types)]
                    struct StartTrainingSvc<T: MlTrainingService>(pub Arc<T>);
                    impl<
                        T: MlTrainingService,
                    > tonic::server::UnaryService<super::StartTrainingRequest>
                    for StartTrainingSvc<T> {
                        type Response = super::StartTrainingResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::StartTrainingRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::start_training(&inner, request)
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = StartTrainingSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/ml_training.MLTrainingService/SubscribeToTrainingStatus" => {
                    #[allow(non_camel_case_types)]
                    struct SubscribeToTrainingStatusSvc<T: MlTrainingService>(
                        pub Arc<T>,
                    );
                    impl<
                        T: MlTrainingService,
                    > tonic::server::ServerStreamingService<
                        super::SubscribeToTrainingStatusRequest,
                    > for SubscribeToTrainingStatusSvc<T> {
                        type Response = super::TrainingStatusUpdate;
                        type ResponseStream = T::SubscribeToTrainingStatusStream;
                        type Future = BoxFuture<
                            tonic::Response<Self::ResponseStream>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                super::SubscribeToTrainingStatusRequest,
                            >,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::subscribe_to_training_status(
                                        &inner,
                                        request,
                                    )
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = SubscribeToTrainingStatusSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.server_streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/ml_training.MLTrainingService/StopTraining" => {
                    #[allow(non_camel_case_types)]
                    struct StopTrainingSvc<T: MlTrainingService>(pub Arc<T>);
                    impl<
                        T: MlTrainingService,
                    > tonic::server::UnaryService<super::StopTrainingRequest>
                    for StopTrainingSvc<T> {
                        type Response = super::StopTrainingResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::StopTrainingRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::stop_training(&inner, request)
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = StopTrainingSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/ml_training.MLTrainingService/ListAvailableModels" => {
                    #[allow(non_camel_case_types)]
                    struct ListAvailableModelsSvc<T: MlTrainingService>(pub Arc<T>);
                    impl<
                        T: MlTrainingService,
                    > tonic::server::UnaryService<super::ListAvailableModelsRequest>
                    for ListAvailableModelsSvc<T> {
                        type Response = super::ListAvailableModelsResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ListAvailableModelsRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::list_available_models(
                                        &inner,
                                        request,
                                    )
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = ListAvailableModelsSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/ml_training.MLTrainingService/ListTrainingJobs" => {
                    #[allow(non_camel_case_types)]
                    struct ListTrainingJobsSvc<T: MlTrainingService>(pub Arc<T>);
                    impl<
                        T: MlTrainingService,
                    > tonic::server::UnaryService<super::ListTrainingJobsRequest>
                    for ListTrainingJobsSvc<T> {
                        type Response = super::ListTrainingJobsResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ListTrainingJobsRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::list_training_jobs(
                                        &inner,
                                        request,
                                    )
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = ListTrainingJobsSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/ml_training.MLTrainingService/GetTrainingJobDetails" => {
                    #[allow(non_camel_case_types)]
                    struct GetTrainingJobDetailsSvc<T: MlTrainingService>(pub Arc<T>);
                    impl<
                        T: MlTrainingService,
                    > tonic::server::UnaryService<super::GetTrainingJobDetailsRequest>
                    for GetTrainingJobDetailsSvc<T> {
                        type Response = super::GetTrainingJobDetailsResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::GetTrainingJobDetailsRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::get_training_job_details(
                                        &inner,
                                        request,
                                    )
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = GetTrainingJobDetailsSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/ml_training.MLTrainingService/HealthCheck" => {
                    #[allow(non_camel_case_types)]
                    struct HealthCheckSvc<T: MlTrainingService>(pub Arc<T>);
                    impl<
                        T: MlTrainingService,
                    > tonic::server::UnaryService<super::HealthCheckRequest>
                    for HealthCheckSvc<T> {
                        type Response = super::HealthCheckResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::HealthCheckRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as MlTrainingService>::health_check(&inner, request)
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = HealthCheckSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        let mut response = http::Response::new(empty_body());
                        let headers = response.headers_mut();
                        headers
                            .insert(
                                tonic::Status::GRPC_STATUS,
                                (tonic::Code::Unimplemented as i32).into(),
                            );
                        headers
                            .insert(
                                http::header::CONTENT_TYPE,
                                tonic::metadata::GRPC_CONTENT_TYPE,
                            );
                        Ok(response)
                    })
                }
            }
        }
    }
    impl<T> Clone for MlTrainingServiceServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "ml_training.MLTrainingService";
    impl<T> tonic::server::NamedService for MlTrainingServiceServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
