/*
 * Rosetta
 *
 * Build Once. Integrate Your Blockchain Everywhere.
 *
 * The version of the OpenAPI document: 1.4.13
 *
 * Generated by: https://openapi-generator.tech
 */

/// SearchTransactionsRequest : SearchTransactionsRequest is used to search for transactions matching a set of provided conditions in canonical blocks.

#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct SearchTransactionsRequest {
    #[serde(rename = "network_identifier")]
    pub network_identifier: crate::NetworkIdentifier,
    #[serde(rename = "operator", skip_serializing_if = "Option::is_none")]
    pub operator: Option<crate::Operator>,
    /// max_block is the largest block index to consider when searching for transactions. If this field is not populated, the current block is considered the max_block.  If you do not specify a max_block, it is possible a newly synced block will interfere with paginated transaction queries (as the offset could become invalid with newly added rows).
    #[serde(rename = "max_block", skip_serializing_if = "Option::is_none")]
    pub max_block: Option<i64>,
    /// offset is the offset into the query result to start returning transactions.  If any search conditions are changed, the query offset will change and you must restart your search iteration.
    #[serde(rename = "offset", skip_serializing_if = "Option::is_none")]
    pub offset: Option<i64>,
    /// limit is the maximum number of transactions to return in one call. The implementation may return <= limit transactions.
    #[serde(rename = "limit", skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    #[serde(
        rename = "transaction_identifier",
        skip_serializing_if = "Option::is_none"
    )]
    pub transaction_identifier: Option<crate::TransactionIdentifier>,
    #[serde(rename = "account_identifier", skip_serializing_if = "Option::is_none")]
    pub account_identifier: Option<crate::AccountIdentifier>,
    #[serde(rename = "coin_identifier", skip_serializing_if = "Option::is_none")]
    pub coin_identifier: Option<crate::CoinIdentifier>,
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<crate::Currency>,
    /// status is the network-specific operation type.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// type is the network-specific operation type.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<String>,
    /// address is AccountIdentifier.Address. This is used to get all transactions related to an AccountIdentifier.Address, regardless of SubAccountIdentifier.
    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
    pub address: Option<String>,
    /// success is a synthetic condition populated by parsing network-specific operation statuses (using the mapping provided in `/network/options`).
    #[serde(rename = "success", skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
}

impl SearchTransactionsRequest {
    /// SearchTransactionsRequest is used to search for transactions matching a set of provided conditions in canonical blocks.
    pub fn new(network_identifier: crate::NetworkIdentifier) -> SearchTransactionsRequest {
        SearchTransactionsRequest {
            network_identifier,
            operator: None,
            max_block: None,
            offset: None,
            limit: None,
            transaction_identifier: None,
            account_identifier: None,
            coin_identifier: None,
            currency: None,
            status: None,
            r#type: None,
            address: None,
            success: None,
        }
    }
}
