// This file is @generated by prost-build.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRequest {
    /// The admin address requesting authentication.
    /// EVM addresses are 0x-prefixed hex (20 bytes); Solana addresses are
    /// base58-encoded Ed25519 public keys (32 bytes).
    #[prost(string, tag = "1")]
    pub address: ::prost::alloc::string::String,
    /// Unix timestamp when the message was created (in seconds)
    #[prost(uint64, tag = "2")]
    pub timestamp: u64,
    /// Random nonce to prevent replay attacks
    #[prost(string, tag = "3")]
    pub nonce: ::prost::alloc::string::String,
    /// Hex-encoded signature over the canonical auth message (with or
    /// without 0x prefix). For EVM addresses this is a 65-byte EIP-712
    /// signature; for Solana addresses this is a 64-byte raw Ed25519
    /// signature.
    #[prost(string, tag = "4")]
    pub signature: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthResponse {
    /// JWT token for authenticated requests
    #[prost(string, tag = "1")]
    pub jwt_token: ::prost::alloc::string::String,
    /// Unix timestamp when the token expires (in seconds)
    #[prost(uint64, tag = "2")]
    pub expires_at: u64,
    /// The address that was authenticated
    #[prost(string, tag = "3")]
    pub address: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InitializeAdminRequest {
    /// The address to set as the initial admin.
    /// EVM addresses are 0x-prefixed hex; Solana addresses are base58.
    #[prost(string, tag = "1")]
    pub address: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InitializeAdminResponse {
    /// JWT token for authenticated requests
    #[prost(string, tag = "1")]
    pub jwt_token: ::prost::alloc::string::String,
    /// Unix timestamp when the token expires (in seconds)
    #[prost(uint64, tag = "2")]
    pub expires_at: u64,
    /// The address that was set as admin
    #[prost(string, tag = "3")]
    pub address: ::prost::alloc::string::String,
    /// Success message
    #[prost(string, tag = "4")]
    pub message: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod auth_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 Authentication service definition
    /// This service does NOT require JWT authentication (it's used to obtain JWT tokens).
    ///
    /// Both EVM (secp256k1 / EIP-712) and Solana (Ed25519) admin identities
    /// are supported. The server dispatches on address format:
    ///
    /// * 0x-prefixed hex  → EVM, signature verified as EIP-712
    /// * base58           → Solana, signature verified as raw Ed25519
    ///
    /// Consumers should not need to know which curve was used — the same
    /// JWT is minted either way and carries the address as an opaque string.
    #[derive(Debug, Clone)]
    pub struct AuthServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl AuthServiceClient<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> AuthServiceClient<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,
        ) -> AuthServiceClient<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,
        {
            AuthServiceClient::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
        }
        /// Initialize the first admin (only works when no admin exists).
        /// Accepts either an EVM (0x...) or a Solana (base58) address.
        /// Returns a JWT token for the newly created admin.
        pub async fn initialize_admin(
            &mut self,
            request: impl tonic::IntoRequest<super::InitializeAdminRequest>,
        ) -> std::result::Result<
            tonic::Response<super::InitializeAdminResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/xyz.aspens.arborter_auth.v1.AuthService/InitializeAdmin",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "xyz.aspens.arborter_auth.v1.AuthService",
                        "InitializeAdmin",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Authenticate with a signature to obtain a JWT token. The signature
        /// scheme is chosen by the address format (see service docstring).
        /// Only works if the address is already an admin.
        pub async fn authenticate_with_signature(
            &mut self,
            request: impl tonic::IntoRequest<super::AuthRequest>,
        ) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/xyz.aspens.arborter_auth.v1.AuthService/AuthenticateWithSignature",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "xyz.aspens.arborter_auth.v1.AuthService",
                        "AuthenticateWithSignature",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
