/*
 * photon-indexer
 *
 * Solana indexer for general compression
 *
 * The version of the OpenAPI document: 0.50.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;

/// AccountContext: This is currently used internally: - Internal (state_updates,..) - GetTransactionWithCompressionInfo (internally) - GetTransactionWithCompressionInfoV2 (internally) All endpoints return AccountV2.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountContext {
    #[serde(rename = "inOutputQueue")]
    pub in_output_queue: bool,
    #[serde(rename = "nullifiedInTree")]
    pub nullified_in_tree: bool,
    /// A 32-byte hash represented as a base58 string.
    #[serde(rename = "nullifier", skip_serializing_if = "Option::is_none")]
    pub nullifier: Option<String>,
    #[serde(
        rename = "nullifierQueueIndex",
        skip_serializing_if = "Option::is_none"
    )]
    pub nullifier_queue_index: Option<u64>,
    /// A Solana public key represented as a base58 string.
    #[serde(rename = "queue")]
    pub queue: String,
    #[serde(rename = "spent")]
    pub spent: bool,
    #[serde(rename = "treeType")]
    pub tree_type: u16,
    /// A 32-byte hash represented as a base58 string.
    #[serde(rename = "txHash", skip_serializing_if = "Option::is_none")]
    pub tx_hash: Option<String>,
}

impl AccountContext {
    /// This is currently used internally: - Internal (state_updates,..) - GetTransactionWithCompressionInfo (internally) - GetTransactionWithCompressionInfoV2 (internally) All endpoints return AccountV2.
    pub fn new(
        in_output_queue: bool,
        nullified_in_tree: bool,
        queue: String,
        spent: bool,
        tree_type: u16,
    ) -> AccountContext {
        AccountContext {
            in_output_queue,
            nullified_in_tree,
            nullifier: None,
            nullifier_queue_index: None,
            queue,
            spent,
            tree_type,
            tx_hash: None,
        }
    }
}
