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

/// OperationIdentifier : The operation_identifier uniquely identifies an operation within a transaction.

#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct OperationIdentifier {
    /// The operation index is used to ensure each operation has a unique identifier within a transaction. This index is only relative to the transaction and NOT GLOBAL. The operations in each transaction should start from index 0.  To clarify, there may not be any notion of an operation index in the blockchain being described.
    #[serde(rename = "index")]
    pub index: i64,
    /// Some blockchains specify an operation index that is essential for client use. For example, Bitcoin uses a network_index to identify which UTXO was used in a transaction.  network_index should not be populated if there is no notion of an operation index in a blockchain (typically most account-based blockchains).
    #[serde(rename = "network_index", skip_serializing_if = "Option::is_none")]
    pub network_index: Option<i64>,
}

impl OperationIdentifier {
    /// The operation_identifier uniquely identifies an operation within a transaction.
    pub fn new(index: i64) -> OperationIdentifier {
        OperationIdentifier {
            index,
            network_index: None,
        }
    }
}
