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

use crate::models;

/// State queue data with shared tree nodes for output and input queues
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[allow(clippy::too_many_arguments)]
pub struct StateQueueDataV2 {
    /// Shared deduplicated tree nodes for state queues (output + input)
    /// node_index encoding: (level << 56) | position
    #[serde(rename = "nodes", skip_serializing_if = "Vec::is_empty", default)]
    pub nodes: Vec<u64>,
    #[serde(rename = "nodeHashes", skip_serializing_if = "Vec::is_empty", default)]
    pub node_hashes: Vec<String>,
    /// Initial root for the state tree (shared by output and input queues)
    #[serde(rename = "initialRoot")]
    pub initial_root: String,
    /// Sequence number of the root
    #[serde(rename = "rootSeq")]
    pub root_seq: u64,
    #[serde(rename = "outputQueue", skip_serializing_if = "Option::is_none")]
    pub output_queue: Option<Box<models::OutputQueueDataV2>>,
    #[serde(rename = "inputQueue", skip_serializing_if = "Option::is_none")]
    pub input_queue: Option<Box<models::InputQueueDataV2>>,
}

impl StateQueueDataV2 {
    pub fn new(initial_root: String, root_seq: u64) -> StateQueueDataV2 {
        StateQueueDataV2 {
            nodes: Vec::new(),
            node_hashes: Vec::new(),
            initial_root,
            root_seq,
            output_queue: None,
            input_queue: None,
        }
    }
}
