// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EffectScope {
    #[prost(string, tag = "1")]
    pub allowed_action: ::prost::alloc::string::String,
    #[prost(string, repeated, tag = "2")]
    pub allowed_params: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(string, repeated, tag = "3")]
    pub deny_patterns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EffectPermit {
    #[prost(string, tag = "1")]
    pub permit_id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub intent_hash: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub verdict_hash: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub plan_hash: ::prost::alloc::string::String,
    #[prost(string, tag = "5")]
    pub policy_hash: ::prost::alloc::string::String,
    #[prost(enumeration = "EffectType", tag = "6")]
    pub effect_type: i32,
    #[prost(string, tag = "7")]
    pub connector_id: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "8")]
    pub scope: ::core::option::Option<EffectScope>,
    #[prost(string, tag = "9")]
    pub resource_ref: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "10")]
    pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(bool, tag = "11")]
    pub single_use: bool,
    #[prost(string, tag = "12")]
    pub nonce: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "13")]
    pub issued_at: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(string, tag = "14")]
    pub issuer_id: ::prost::alloc::string::String,
    #[prost(string, tag = "15")]
    pub signature: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GatewayEffectRequest {
    #[prost(string, tag = "1")]
    pub request_id: ::prost::alloc::string::String,
    #[prost(enumeration = "EffectType", tag = "2")]
    pub effect_type: i32,
    #[prost(string, tag = "3")]
    pub connector_id: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub tool_name: ::prost::alloc::string::String,
    /// JSON-encoded
    #[prost(bytes = "vec", tag = "5")]
    pub params: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "6")]
    pub resource_ref: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub plan_hash: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub policy_hash: ::prost::alloc::string::String,
    #[prost(string, tag = "9")]
    pub verdict_hash: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "10")]
    pub requested_at: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GatewayEffectOutcome {
    #[prost(string, tag = "1")]
    pub request_id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub permit_id: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub success: bool,
    #[prost(bytes = "vec", tag = "4")]
    pub output: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "5")]
    pub error: ::prost::alloc::string::String,
    #[prost(string, tag = "6")]
    pub output_hash: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "7")]
    pub duration: ::core::option::Option<::prost_types::Duration>,
    #[prost(message, optional, tag = "8")]
    pub completed_at: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EffectType {
    Unspecified = 0,
    Read = 1,
    Write = 2,
    Delete = 3,
    Execute = 4,
    Network = 5,
    Finance = 6,
}
impl EffectType {
    /// 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 => "EFFECT_TYPE_UNSPECIFIED",
            Self::Read => "EFFECT_TYPE_READ",
            Self::Write => "EFFECT_TYPE_WRITE",
            Self::Delete => "EFFECT_TYPE_DELETE",
            Self::Execute => "EFFECT_TYPE_EXECUTE",
            Self::Network => "EFFECT_TYPE_NETWORK",
            Self::Finance => "EFFECT_TYPE_FINANCE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "EFFECT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "EFFECT_TYPE_READ" => Some(Self::Read),
            "EFFECT_TYPE_WRITE" => Some(Self::Write),
            "EFFECT_TYPE_DELETE" => Some(Self::Delete),
            "EFFECT_TYPE_EXECUTE" => Some(Self::Execute),
            "EFFECT_TYPE_NETWORK" => Some(Self::Network),
            "EFFECT_TYPE_FINANCE" => Some(Self::Finance),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod effects_gateway_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    #[derive(Debug, Clone)]
    pub struct EffectsGatewayServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl EffectsGatewayServiceClient<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> EffectsGatewayServiceClient<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,
        ) -> EffectsGatewayServiceClient<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,
        {
            EffectsGatewayServiceClient::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
        }
        pub async fn execute(
            &mut self,
            request: impl tonic::IntoRequest<super::GatewayEffectRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GatewayEffectOutcome>,
            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(
                "/helm.effects.v1.EffectsGatewayService/Execute",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("helm.effects.v1.EffectsGatewayService", "Execute"),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
