// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Empty {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CancelOrderRequest {
    #[prost(message, optional, tag = "1")]
    pub order: ::core::option::Option<OrderToCancel>,
    #[prost(bytes = "vec", tag = "2")]
    pub signature_hash: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOrderResponse {
    /// Whether the order was found and canceled
    #[prost(bool, tag = "1")]
    pub order_canceled: bool,
    /// Transaction hashes associated with this cancellation
    #[prost(message, repeated, tag = "2")]
    pub transaction_hashes: ::prost::alloc::vec::Vec<TransactionHash>,
    /// Current state of the orderbook after this operation
    #[prost(message, repeated, tag = "3")]
    pub current_orderbook: ::prost::alloc::vec::Vec<OrderbookEntry>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OrderbookRequest {
    /// Used to keep the client alive
    #[prost(bool, tag = "1")]
    pub continue_stream: bool,
    /// The market id to stream orders for
    #[prost(string, tag = "2")]
    pub market_id: ::prost::alloc::string::String,
    /// If true, returns existing open orders when stream starts, then continues streaming
    #[prost(bool, optional, tag = "3")]
    pub historical_open_orders: ::core::option::Option<bool>,
    /// If this is sent too, then we filter by a specific trader
    #[prost(string, optional, tag = "4")]
    pub filter_by_trader: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TradeRequest {
    /// Used to keep the client alive
    #[prost(bool, tag = "1")]
    pub continue_stream: bool,
    /// The market id to stream orders for
    #[prost(string, tag = "2")]
    pub market_id: ::prost::alloc::string::String,
    /// If true, returns existing closed when stream starts, then continues streaming
    #[prost(bool, optional, tag = "3")]
    pub historical_closed_trades: ::core::option::Option<bool>,
    /// If this is sent too, then we filter by a specific trader
    #[prost(string, optional, tag = "4")]
    pub filter_by_trader: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SendOrderRequest {
    /// The order to send
    #[prost(message, optional, tag = "1")]
    pub order: ::core::option::Option<Order>,
    /// Valid EIP-712 signature hash of this order
    #[prost(bytes = "vec", tag = "2")]
    pub signature_hash: ::prost::alloc::vec::Vec<u8>,
    /// Gasless authorization: the arborter drives the on-chain lock via the
    /// chain's gasless path (Solana: MidribOpenFor with Ed25519 precompile;
    /// EVM: MidribV2.openFor with Permit2). Required — the legacy
    /// arborter-signed lock path has been removed. For message-typed
    /// fields, proto3 tracks presence by default, so the generated Rust
    /// API remains `Option<GaslessAuthorization>`; the arborter handler
    /// enforces presence at the request boundary.
    #[prost(message, optional, tag = "3")]
    pub gasless: ::core::option::Option<GaslessAuthorization>,
}
/// User-produced authorization bundle for a gasless on-chain open. The
/// signature semantics + deadline units are chain-specific and match the
/// `chain_traits::market::GaslessLockParams` fields:
///
/// * Solana: 64-byte Ed25519 signature; deadline is a slot number.
/// * EVM:    65-byte ECDSA signature; deadline is a unix timestamp.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GaslessAuthorization {
    /// Raw signature bytes — see chain-specific format above.
    #[prost(bytes = "vec", tag = "1")]
    pub user_signature: ::prost::alloc::vec::Vec<u8>,
    /// Absolute deadline the arborter must land the tx before.
    /// Solana: slot number. EVM: fillDeadline (unix seconds).
    #[prost(uint64, tag = "2")]
    pub deadline: u64,
    /// On-chain order id (32-byte hex, 0x-prefixed) that the user's
    /// signature binds to — matches the on-chain Order PDA / EVM intent id.
    #[prost(string, tag = "3")]
    pub order_id: ::prost::alloc::string::String,
    /// Permit2 / EIP-712 nonce stamped on the user-signed EVM order.
    /// Ignored by Solana (the Order PDA init serves as the nonce).
    #[prost(uint64, tag = "4")]
    pub nonce: u64,
    /// EVM openDeadline (unix seconds). Ignored by Solana.
    #[prost(uint64, tag = "5")]
    pub open_deadline: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Order {
    /// 'BID' or 'ASK'
    #[prost(enumeration = "Side", tag = "1")]
    pub side: i32,
    /// Order size
    #[prost(string, tag = "2")]
    pub quantity: ::prost::alloc::string::String,
    /// Optional. including is a LIMIT order. excluding is a MARKET order.
    #[prost(string, optional, tag = "3")]
    pub price: ::core::option::Option<::prost::alloc::string::String>,
    /// Identity the market: concat(base_chain_id "::" token_address "::" quote_chain_id "::" token_address)
    #[prost(string, tag = "4")]
    pub market_id: ::prost::alloc::string::String,
    /// User's pubkey (address) on the Base chain
    #[prost(string, tag = "5")]
    pub base_account_address: ::prost::alloc::string::String,
    /// User's pubkey (address) on the Quote chain
    #[prost(string, tag = "6")]
    pub quote_account_address: ::prost::alloc::string::String,
    /// 'DIRECT' (default) or 'DISCRETIONARY'
    #[prost(enumeration = "ExecutionType", tag = "7")]
    pub execution_type: i32,
    /// When execution_type == 'discretionary', include order_ids to match with.
    #[prost(uint64, repeated, tag = "8")]
    pub matching_order_ids: ::prost::alloc::vec::Vec<u64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Trade {
    /// When the engine registers this executed trade
    #[prost(uint64, tag = "1")]
    pub timestamp: u64,
    /// The setttled price net of fees
    #[prost(string, tag = "2")]
    pub price: ::prost::alloc::string::String,
    /// How much or many of the quote token
    #[prost(string, tag = "3")]
    pub qty: ::prost::alloc::string::String,
    /// Maker's internal trader id. Safely ignore.
    #[prost(string, tag = "4")]
    pub maker_id: ::prost::alloc::string::String,
    /// Taker's internal trader id. Safely ignore.
    #[prost(string, tag = "5")]
    pub taker_id: ::prost::alloc::string::String,
    /// The maker's base chain wallet address
    #[prost(string, tag = "6")]
    pub maker_base_address: ::prost::alloc::string::String,
    /// The maker's quote chain wallet address
    #[prost(string, tag = "7")]
    pub maker_quote_address: ::prost::alloc::string::String,
    /// The taker's base chain wallet address
    #[prost(string, tag = "8")]
    pub taker_base_address: ::prost::alloc::string::String,
    /// The taker's quote chain wallet address
    #[prost(string, tag = "9")]
    pub taker_quote_address: ::prost::alloc::string::String,
    /// Who is the buyer in this trade (MAKER or TAKER)
    #[prost(enumeration = "TradeRole", tag = "10")]
    pub buyer_is: i32,
    /// Who is the seller in this trade (MAKER or TAKER)
    #[prost(enumeration = "TradeRole", tag = "11")]
    pub seller_is: i32,
    /// The order_id that created this trade.
    #[prost(uint64, tag = "12")]
    pub order_hit: u64,
}
/// Transaction hash information
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TransactionHash {
    /// Type of transaction hash
    #[prost(string, tag = "1")]
    pub hash_type: ::prost::alloc::string::String,
    /// The transaction hash value
    #[prost(string, tag = "2")]
    pub hash_value: ::prost::alloc::string::String,
}
/// rpc: SendOrder
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendOrderResponse {
    /// Whether the order has unmatched volume and has been added to the book.
    #[prost(bool, tag = "1")]
    pub order_in_book: bool,
    /// If the order lands in the book, what remains unfilled from the order.
    #[prost(message, optional, tag = "2")]
    pub order: ::core::option::Option<Order>,
    /// Which other orders, if any, this order was matched with.
    #[prost(message, repeated, tag = "3")]
    pub trades: ::prost::alloc::vec::Vec<Trade>,
    /// Transaction hashes associated with this order
    #[prost(message, repeated, tag = "4")]
    pub transaction_hashes: ::prost::alloc::vec::Vec<TransactionHash>,
    /// Current state of the orderbook after this operation
    #[prost(message, repeated, tag = "5")]
    pub current_orderbook: ::prost::alloc::vec::Vec<OrderbookEntry>,
    /// The unique identifier for this order
    #[prost(uint64, tag = "6")]
    pub order_id: u64,
}
/// rpc: CancelOrder
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OrderToCancel {
    /// Identity the market: concat(base_chain_id "::" token_address "::" quote_chain_id "::" token_address)
    #[prost(string, tag = "1")]
    pub market_id: ::prost::alloc::string::String,
    /// 'BID' or 'ASK'
    #[prost(enumeration = "Side", tag = "2")]
    pub side: i32,
    /// the token address
    #[prost(string, tag = "3")]
    pub token_address: ::prost::alloc::string::String,
    /// Internal order Id.
    #[prost(uint64, tag = "4")]
    pub order_id: u64,
}
/// rpc: Orderbook
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OrderbookEntry {
    /// when the order first landed in The Orderbook
    #[prost(uint64, tag = "1")]
    pub timestamp: u64,
    /// internal id of the order
    #[prost(uint64, tag = "2")]
    pub order_id: u64,
    /// price of the order - in non-decimal form
    #[prost(string, tag = "3")]
    pub price: ::prost::alloc::string::String,
    /// quantity of the order - in non-decimal form
    #[prost(string, tag = "4")]
    pub quantity: ::prost::alloc::string::String,
    /// 'BID = 1' or 'ASK = 2'
    #[prost(enumeration = "Side", tag = "5")]
    pub side: i32,
    /// The maker's base chain wallet address
    #[prost(string, tag = "6")]
    pub maker_base_address: ::prost::alloc::string::String,
    /// The maker's quote chain wallet address
    #[prost(string, tag = "7")]
    pub maker_quote_address: ::prost::alloc::string::String,
    /// The market ID this order belongs to
    #[prost(string, tag = "8")]
    pub market_id: ::prost::alloc::string::String,
    /// The actual state of the order (Pending, Confirmed, Matched, Canceled, Settled)
    #[prost(enumeration = "OrderState", tag = "9")]
    pub state: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Side {
    Unspecified = 0,
    Bid = 1,
    Ask = 2,
}
impl Side {
    /// 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 => "SIDE_UNSPECIFIED",
            Self::Bid => "SIDE_BID",
            Self::Ask => "SIDE_ASK",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SIDE_UNSPECIFIED" => Some(Self::Unspecified),
            "SIDE_BID" => Some(Self::Bid),
            "SIDE_ASK" => Some(Self::Ask),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ExecutionType {
    /// Default - direct
    Unspecified = 0,
    /// For dealroom use.
    Discretionary = 1,
}
impl ExecutionType {
    /// 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 => "EXECUTION_TYPE_UNSPECIFIED",
            Self::Discretionary => "EXECUTION_TYPE_DISCRETIONARY",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "EXECUTION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "EXECUTION_TYPE_DISCRETIONARY" => Some(Self::Discretionary),
            _ => None,
        }
    }
}
/// The actual state of an order in the matching engine
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OrderState {
    Unspecified = 0,
    /// Order submitted, funds locked on-chain, shows in orderbook but NOT matchable
    Pending = 1,
    /// OrderOpen blockchain event received, order is now matchable
    Confirmed = 2,
    /// Order matched by matching engine, trade recorded
    Matched = 3,
    /// Order canceled
    Canceled = 4,
    /// On-chain settlement completed successfully
    Settled = 5,
}
impl OrderState {
    /// 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 => "ORDER_STATE_UNSPECIFIED",
            Self::Pending => "ORDER_STATE_PENDING",
            Self::Confirmed => "ORDER_STATE_CONFIRMED",
            Self::Matched => "ORDER_STATE_MATCHED",
            Self::Canceled => "ORDER_STATE_CANCELED",
            Self::Settled => "ORDER_STATE_SETTLED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ORDER_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "ORDER_STATE_PENDING" => Some(Self::Pending),
            "ORDER_STATE_CONFIRMED" => Some(Self::Confirmed),
            "ORDER_STATE_MATCHED" => Some(Self::Matched),
            "ORDER_STATE_CANCELED" => Some(Self::Canceled),
            "ORDER_STATE_SETTLED" => Some(Self::Settled),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TradeRole {
    Unspecified = 0,
    Maker = 1,
    Taker = 2,
}
impl TradeRole {
    /// 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 => "TRADE_ROLE_UNSPECIFIED",
            Self::Maker => "MAKER",
            Self::Taker => "TAKER",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TRADE_ROLE_UNSPECIFIED" => Some(Self::Unspecified),
            "MAKER" => Some(Self::Maker),
            "TAKER" => Some(Self::Taker),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod arborter_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 ArborterServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ArborterServiceClient<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> ArborterServiceClient<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,
        ) -> ArborterServiceClient<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,
        {
            ArborterServiceClient::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 send_order(
            &mut self,
            request: impl tonic::IntoRequest<super::SendOrderRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SendOrderResponse>,
            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.v1.ArborterService/SendOrder",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "xyz.aspens.arborter.v1.ArborterService",
                        "SendOrder",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn cancel_order(
            &mut self,
            request: impl tonic::IntoRequest<super::CancelOrderRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CancelOrderResponse>,
            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.v1.ArborterService/CancelOrder",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "xyz.aspens.arborter.v1.ArborterService",
                        "CancelOrder",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn trades(
            &mut self,
            request: impl tonic::IntoRequest<super::TradeRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::Trade>>,
            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.v1.ArborterService/Trades",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new("xyz.aspens.arborter.v1.ArborterService", "Trades"),
                );
            self.inner.server_streaming(req, path, codec).await
        }
        pub async fn orderbook(
            &mut self,
            request: impl tonic::IntoRequest<super::OrderbookRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::OrderbookEntry>>,
            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.v1.ArborterService/Orderbook",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "xyz.aspens.arborter.v1.ArborterService",
                        "Orderbook",
                    ),
                );
            self.inner.server_streaming(req, path, codec).await
        }
    }
}
