/*
 * This is an auto-generated file.
 * Any manual changes may be overwritten without notice!
 */

use derive_builder::Builder;
use serde::{Deserialize, Serialize};

/// QueryOptions are used to parametrize a query
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct QueryOptions {
    /// AllowStale allows any Nomad server (non-leader) to service
    /// a read. This allows for lower latency and higher throughput
    #[serde(rename = "AllowStale")]
    pub allow_stale: bool,

    /// If set, used as prefix for resource list searches
    #[serde(rename = "Prefix")]
    pub prefix: String,

    /// Set HTTP parameters on the query.
    #[serde(rename = "Params")]
    pub params: std::collections::HashMap<String, String>,

    /// Set HTTP headers on the query.
    #[serde(rename = "Headers")]
    pub headers: std::collections::HashMap<String, String>,

    /// AuthToken is the secret ID of an ACL token
    #[serde(rename = "AuthToken")]
    pub auth_token: String,

    /// Reverse is used to reverse the default order of list results.
    ///
    /// Currently only supported by specific endpoints.
    #[serde(rename = "Reverse")]
    pub reverse: bool,

    /// WaitIndex is used to enable a blocking query. Waits
    /// until the timeout or the next index is reached
    #[serde(rename = "WaitIndex")]
    pub wait_index: u64,

    /// NextToken is the token used to indicate where to start paging
    /// for queries that support paginated lists. This token should be
    /// the ID of the next object after the last one seen in the
    /// previous response.
    #[serde(rename = "NextToken")]
    pub next_token: String,

    /// Providing a datacenter overwrites the region provided
    /// by the Config
    #[serde(rename = "Region")]
    pub region: String,

    /// PerPage is the number of entries to be returned in queries that support
    /// paginated lists.
    #[serde(rename = "PerPage")]
    pub per_page: i32,

    /// Namespace is the target namespace for the query.
    #[serde(rename = "Namespace")]
    pub namespace: String,

    /// WaitTime is used to bound the duration of a wait.
    /// Defaults to that of the Config, but can be overridden.
    #[serde(
        rename = "WaitTime",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub wait_time: chrono::TimeDelta,

    /// Filter specifies the go-bexpr filter expression to be used for
    /// filtering the data prior to returning a response
    #[serde(rename = "Filter")]
    pub filter: String,
}
