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

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

/// QueryMeta is used to return meta data about 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 QueryMeta {
    /// LastIndex. This can be used as a WaitIndex to perform
    /// a blocking query
    #[serde(rename = "LastIndex")]
    pub last_index: u64,

    /// Time of last contact from the leader for the
    /// server servicing the request
    #[serde(
        rename = "LastContact",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub last_contact: chrono::TimeDelta,

    /// Is there a known leader
    #[serde(rename = "KnownLeader")]
    pub known_leader: bool,

    /// How long did the request take
    #[serde(
        rename = "RequestTime",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub request_time: chrono::TimeDelta,

    /// NextToken is the token used to indicate where to start paging
    /// for queries that support paginated lists. To resume paging from
    /// this point, pass this token in the next request's QueryOptions
    #[serde(rename = "NextToken")]
    pub next_token: String,
}
