// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CreateDatasetSyncRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateSyncRequest {
    /// rid in the local environment
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
    /// rid in the data center environment
    #[prost(string, tag = "2")]
    pub target_rid: ::prost::alloc::string::String,
    /// secret to be used for communication with the data center
    #[prost(string, tag = "3")]
    pub secret_rid: ::prost::alloc::string::String,
    /// whether or not the sync should be enabled
    #[prost(bool, tag = "4")]
    pub enabled: bool,
    #[prost(oneof = "create_sync_request::Request", tags = "5")]
    pub request: ::core::option::Option<create_sync_request::Request>,
}
/// Nested message and enum types in `CreateSyncRequest`.
pub mod create_sync_request {
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Request {
        #[prost(message, tag = "5")]
        Dataset(super::CreateDatasetSyncRequest),
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CreateSyncResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSyncRequest {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DatasetSync {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Sync {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub target_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub secret_rid: ::prost::alloc::string::String,
    #[prost(bool, tag = "4")]
    pub enabled: bool,
    #[prost(oneof = "sync::Sync", tags = "5")]
    pub sync: ::core::option::Option<sync::Sync>,
}
/// Nested message and enum types in `Sync`.
pub mod sync {
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Sync {
        #[prost(message, tag = "5")]
        Dataset(super::DatasetSync),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSyncResponse {
    #[prost(message, optional, tag = "1")]
    pub sync: ::core::option::Option<Sync>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSyncRequest {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub target_rid: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "3")]
    pub secret_rid: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(bool, optional, tag = "4")]
    pub enabled: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSyncResponse {
    #[prost(message, optional, tag = "1")]
    pub sync: ::core::option::Option<Sync>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteSyncRequest {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteSyncResponse {}
/// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EdgeSyncServiceError {
    SyncNotFound = 0,
    SyncAlreadyExists = 1,
}
impl EdgeSyncServiceError {
    /// 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::SyncNotFound => "EDGE_SYNC_SERVICE_ERROR_SYNC_NOT_FOUND",
            Self::SyncAlreadyExists => "EDGE_SYNC_SERVICE_ERROR_SYNC_ALREADY_EXISTS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "EDGE_SYNC_SERVICE_ERROR_SYNC_NOT_FOUND" => Some(Self::SyncNotFound),
            "EDGE_SYNC_SERVICE_ERROR_SYNC_ALREADY_EXISTS" => {
                Some(Self::SyncAlreadyExists)
            }
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod edge_sync_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Manages resource syncing from the edge side.
    #[derive(Debug, Clone)]
    pub struct EdgeSyncServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl EdgeSyncServiceClient<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> EdgeSyncServiceClient<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,
        ) -> EdgeSyncServiceClient<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,
        {
            EdgeSyncServiceClient::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
        }
        /// Creates a sync which allows the specified dataset to be backfilled from edge environments.
        /// Throws EDGE_SYNC_SERVICE_ERROR_SYNC_ALREADY_EXISTS if a sync already exists.
        pub async fn create_sync(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateSyncRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateSyncResponse>,
            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.edge.v1.EdgeSyncService/CreateSync",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.edge.v1.EdgeSyncService", "CreateSync"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Retrieves a sync for the requested resource, throwing EDGE_SYNC_SERVICE_ERROR_SYNC_NOT_FOUND if there is no sync.
        pub async fn get_sync(
            &mut self,
            request: impl tonic::IntoRequest<super::GetSyncRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetSyncResponse>,
            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.edge.v1.EdgeSyncService/GetSync",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("nominal.edge.v1.EdgeSyncService", "GetSync"));
            self.inner.unary(req, path, codec).await
        }
        /// Updates a sync for the requested resource, throwing EDGE_SYNC_SERVICE_ERROR_SYNC_NOT_FOUND if there is no sync.
        pub async fn update_sync(
            &mut self,
            request: impl tonic::IntoRequest<super::UpdateSyncRequest>,
        ) -> std::result::Result<
            tonic::Response<super::UpdateSyncResponse>,
            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.edge.v1.EdgeSyncService/UpdateSync",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.edge.v1.EdgeSyncService", "UpdateSync"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Deletes a sync which allows the specified resource to be backfilled from edge environments.
        pub async fn delete_sync(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteSyncRequest>,
        ) -> std::result::Result<
            tonic::Response<super::DeleteSyncResponse>,
            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.edge.v1.EdgeSyncService/DeleteSync",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("nominal.edge.v1.EdgeSyncService", "DeleteSync"),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
