// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Effect {
    #[prost(string, tag = "1")]
    pub effect_type: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub effect_id: ::prost::alloc::string::String,
    /// JSON-encoded parameters
    #[prost(bytes = "vec", tag = "3")]
    pub params: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "4")]
    pub budget_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DecisionRecord {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(enumeration = "Verdict", tag = "3")]
    pub verdict: i32,
    #[prost(string, tag = "4")]
    pub reason: ::prost::alloc::string::String,
    #[prost(enumeration = "ReasonCode", tag = "5")]
    pub reason_code: i32,
    #[prost(string, tag = "6")]
    pub effect_digest: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub requirement_set_hash: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub signature: ::prost::alloc::string::String,
    #[prost(string, tag = "9")]
    pub signer_key_id: ::prost::alloc::string::String,
    #[prost(string, tag = "10")]
    pub policy_ref: ::prost::alloc::string::String,
    #[prost(string, tag = "11")]
    pub policy_decision_hash: ::prost::alloc::string::String,
    #[prost(bytes = "vec", tag = "12")]
    pub input_context: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthorizedExecutionIntent {
    #[prost(string, tag = "1")]
    pub intent_id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub decision_id: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub effect_id: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub issued_at: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(message, optional, tag = "5")]
    pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(string, tag = "6")]
    pub signature: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub signer_key_id: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub principal: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Receipt {
    #[prost(string, tag = "1")]
    pub receipt_version: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub receipt_id: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub decision_id: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub effect_id: ::prost::alloc::string::String,
    #[prost(enumeration = "Verdict", tag = "5")]
    pub verdict: i32,
    #[prost(string, tag = "6")]
    pub principal: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub tool: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub action: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "9")]
    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(uint64, tag = "10")]
    pub lamport: u64,
    #[prost(string, tag = "11")]
    pub proofgraph_node: ::prost::alloc::string::String,
    #[prost(string, tag = "12")]
    pub signature: ::prost::alloc::string::String,
    #[prost(string, tag = "13")]
    pub signer_key_id: ::prost::alloc::string::String,
    #[prost(string, tag = "14")]
    pub payload_hash: ::prost::alloc::string::String,
    #[prost(enumeration = "ReasonCode", tag = "15")]
    pub reason_code: i32,
    #[prost(map = "string, string", tag = "16")]
    pub metadata: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PdpRequest {
    #[prost(message, optional, tag = "1")]
    pub effect: ::core::option::Option<Effect>,
    #[prost(message, optional, tag = "2")]
    pub subject: ::core::option::Option<SubjectDescriptor>,
    #[prost(message, optional, tag = "3")]
    pub context: ::core::option::Option<ContextDescriptor>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubjectDescriptor {
    #[prost(string, tag = "1")]
    pub principal: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub tenant: ::prost::alloc::string::String,
    #[prost(string, repeated, tag = "3")]
    pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ContextDescriptor {
    #[prost(string, tag = "1")]
    pub jurisdiction: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub environment: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub time_window_start: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(message, optional, tag = "4")]
    pub time_window_end: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PdpResponse {
    #[prost(bool, tag = "1")]
    pub allow: bool,
    #[prost(enumeration = "ReasonCode", tag = "2")]
    pub reason_code: i32,
    #[prost(string, tag = "3")]
    pub policy_ref: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub decision_hash: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "5")]
    pub obligations: ::prost::alloc::vec::Vec<Obligation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Obligation {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub r#type: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub description: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub deadline: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EffectRequest {
    #[prost(message, optional, tag = "1")]
    pub effect: ::core::option::Option<Effect>,
    #[prost(string, tag = "2")]
    pub principal: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "3")]
    pub context: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EffectResponse {
    #[prost(enumeration = "Verdict", tag = "1")]
    pub verdict: i32,
    #[prost(enumeration = "ReasonCode", tag = "2")]
    pub reason_code: i32,
    #[prost(string, tag = "3")]
    pub reason: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "4")]
    pub receipt: ::core::option::Option<Receipt>,
    #[prost(message, optional, tag = "5")]
    pub intent: ::core::option::Option<AuthorizedExecutionIntent>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutionResult {
    #[prost(string, tag = "1")]
    pub intent_id: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub success: bool,
    #[prost(bytes = "vec", tag = "3")]
    pub output: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "4")]
    pub error_message: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "5")]
    pub completed_at: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompletionReceipt {
    #[prost(message, optional, tag = "1")]
    pub receipt: ::core::option::Option<Receipt>,
    #[prost(string, tag = "2")]
    pub proofgraph_node: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Verdict {
    Unspecified = 0,
    Allow = 1,
    Deny = 2,
    Escalate = 3,
}
impl Verdict {
    /// 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 => "VERDICT_UNSPECIFIED",
            Self::Allow => "VERDICT_ALLOW",
            Self::Deny => "VERDICT_DENY",
            Self::Escalate => "VERDICT_ESCALATE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "VERDICT_UNSPECIFIED" => Some(Self::Unspecified),
            "VERDICT_ALLOW" => Some(Self::Allow),
            "VERDICT_DENY" => Some(Self::Deny),
            "VERDICT_ESCALATE" => Some(Self::Escalate),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ReasonCode {
    Unspecified = 0,
    PolicyViolation = 1,
    NoPolicyDefined = 2,
    PrgEvaluationError = 3,
    MissingRequirement = 4,
    PdpDeny = 5,
    PdpError = 6,
    BudgetExceeded = 7,
    BudgetError = 8,
    EnvelopeInvalid = 9,
    SchemaViolation = 10,
    TemporalIntervention = 11,
    TemporalThrottle = 12,
    SandboxViolation = 13,
    ProvenanceFailure = 14,
    VerificationFailure = 15,
    TenantIsolation = 16,
    JurisdictionViolation = 17,
}
impl ReasonCode {
    /// 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 => "REASON_CODE_UNSPECIFIED",
            Self::PolicyViolation => "REASON_CODE_POLICY_VIOLATION",
            Self::NoPolicyDefined => "REASON_CODE_NO_POLICY_DEFINED",
            Self::PrgEvaluationError => "REASON_CODE_PRG_EVALUATION_ERROR",
            Self::MissingRequirement => "REASON_CODE_MISSING_REQUIREMENT",
            Self::PdpDeny => "REASON_CODE_PDP_DENY",
            Self::PdpError => "REASON_CODE_PDP_ERROR",
            Self::BudgetExceeded => "REASON_CODE_BUDGET_EXCEEDED",
            Self::BudgetError => "REASON_CODE_BUDGET_ERROR",
            Self::EnvelopeInvalid => "REASON_CODE_ENVELOPE_INVALID",
            Self::SchemaViolation => "REASON_CODE_SCHEMA_VIOLATION",
            Self::TemporalIntervention => "REASON_CODE_TEMPORAL_INTERVENTION",
            Self::TemporalThrottle => "REASON_CODE_TEMPORAL_THROTTLE",
            Self::SandboxViolation => "REASON_CODE_SANDBOX_VIOLATION",
            Self::ProvenanceFailure => "REASON_CODE_PROVENANCE_FAILURE",
            Self::VerificationFailure => "REASON_CODE_VERIFICATION_FAILURE",
            Self::TenantIsolation => "REASON_CODE_TENANT_ISOLATION",
            Self::JurisdictionViolation => "REASON_CODE_JURISDICTION_VIOLATION",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "REASON_CODE_UNSPECIFIED" => Some(Self::Unspecified),
            "REASON_CODE_POLICY_VIOLATION" => Some(Self::PolicyViolation),
            "REASON_CODE_NO_POLICY_DEFINED" => Some(Self::NoPolicyDefined),
            "REASON_CODE_PRG_EVALUATION_ERROR" => Some(Self::PrgEvaluationError),
            "REASON_CODE_MISSING_REQUIREMENT" => Some(Self::MissingRequirement),
            "REASON_CODE_PDP_DENY" => Some(Self::PdpDeny),
            "REASON_CODE_PDP_ERROR" => Some(Self::PdpError),
            "REASON_CODE_BUDGET_EXCEEDED" => Some(Self::BudgetExceeded),
            "REASON_CODE_BUDGET_ERROR" => Some(Self::BudgetError),
            "REASON_CODE_ENVELOPE_INVALID" => Some(Self::EnvelopeInvalid),
            "REASON_CODE_SCHEMA_VIOLATION" => Some(Self::SchemaViolation),
            "REASON_CODE_TEMPORAL_INTERVENTION" => Some(Self::TemporalIntervention),
            "REASON_CODE_TEMPORAL_THROTTLE" => Some(Self::TemporalThrottle),
            "REASON_CODE_SANDBOX_VIOLATION" => Some(Self::SandboxViolation),
            "REASON_CODE_PROVENANCE_FAILURE" => Some(Self::ProvenanceFailure),
            "REASON_CODE_VERIFICATION_FAILURE" => Some(Self::VerificationFailure),
            "REASON_CODE_TENANT_ISOLATION" => Some(Self::TenantIsolation),
            "REASON_CODE_JURISDICTION_VIOLATION" => Some(Self::JurisdictionViolation),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod policy_decision_point_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 PolicyDecisionPointServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl PolicyDecisionPointServiceClient<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> PolicyDecisionPointServiceClient<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,
        ) -> PolicyDecisionPointServiceClient<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,
        {
            PolicyDecisionPointServiceClient::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 evaluate(
            &mut self,
            request: impl tonic::IntoRequest<super::PdpRequest>,
        ) -> std::result::Result<tonic::Response<super::PdpResponse>, 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.kernel.v1.PolicyDecisionPointService/Evaluate",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "helm.kernel.v1.PolicyDecisionPointService",
                        "Evaluate",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
/// Generated client implementations.
pub mod effect_boundary_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 EffectBoundaryServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl EffectBoundaryServiceClient<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> EffectBoundaryServiceClient<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,
        ) -> EffectBoundaryServiceClient<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,
        {
            EffectBoundaryServiceClient::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
        }
        /// Submit submits an effect for governance evaluation.
        /// Returns a verdict, receipt, and (if ALLOW) an authorized execution intent.
        pub async fn submit(
            &mut self,
            request: impl tonic::IntoRequest<super::EffectRequest>,
        ) -> std::result::Result<tonic::Response<super::EffectResponse>, 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.kernel.v1.EffectBoundaryService/Submit",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("helm.kernel.v1.EffectBoundaryService", "Submit"),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Complete reports the execution result and receives a completion receipt.
        pub async fn complete(
            &mut self,
            request: impl tonic::IntoRequest<super::ExecutionResult>,
        ) -> std::result::Result<
            tonic::Response<super::CompletionReceipt>,
            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.kernel.v1.EffectBoundaryService/Complete",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("helm.kernel.v1.EffectBoundaryService", "Complete"),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
