/*
 * 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;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountV2 {
    /// A Solana public key represented as a base58 string.
    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
    pub address: Option<String>,
    #[serde(rename = "data", skip_serializing_if = "Option::is_none")]
    pub data: Option<Box<models::AccountData>>,
    /// A 32-byte hash represented as a base58 string.
    #[serde(rename = "hash")]
    pub hash: String,
    #[serde(rename = "lamports")]
    pub lamports: u64,
    #[serde(rename = "leafIndex")]
    pub leaf_index: u32,
    #[serde(rename = "merkleContext")]
    pub merkle_context: Box<models::MerkleContextV2>,
    /// A Solana public key represented as a base58 string.
    #[serde(rename = "owner")]
    pub owner: String,
    #[serde(rename = "proveByIndex")]
    pub prove_by_index: bool,
    #[serde(rename = "seq", skip_serializing_if = "Option::is_none")]
    pub seq: Option<u64>,
    #[serde(rename = "slotCreated")]
    pub slot_created: u64,
}

impl AccountV2 {
    pub fn new(
        hash: String,
        lamports: u64,
        leaf_index: u32,
        merkle_context: models::MerkleContextV2,
        owner: String,
        prove_by_index: bool,
        slot_created: u64,
    ) -> AccountV2 {
        AccountV2 {
            address: None,
            data: None,
            hash,
            lamports,
            leaf_index,
            merkle_context: Box::new(merkle_context),
            owner,
            prove_by_index,
            seq: None,
            slot_created,
        }
    }
}
