//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/codama-idl/codama>
//!

use crate::generated::types::TrimVerificationConfigArgs;
use borsh::BorshDeserialize;
use borsh::BorshSerialize;

pub const TRIM_VERIFICATION_CONFIG_DISCRIMINATOR: u8 = 4;

/// Accounts.
#[derive(Debug)]
pub struct TrimVerificationConfig {
    pub mint: solana_pubkey::Pubkey,

    pub verification_config_or_mint_authority: solana_pubkey::Pubkey,

    pub instructions_sysvar_or_creator: solana_pubkey::Pubkey,

    pub mint_account: solana_pubkey::Pubkey,

    pub config_account: solana_pubkey::Pubkey,

    pub recipient: solana_pubkey::Pubkey,

    pub system_program: solana_pubkey::Pubkey,

    pub account_metas_pda: Option<solana_pubkey::Pubkey>,

    pub transfer_hook_pda: Option<solana_pubkey::Pubkey>,

    pub transfer_hook_program: Option<solana_pubkey::Pubkey>,
}

impl TrimVerificationConfig {
    pub fn instruction(
        &self,
        args: TrimVerificationConfigInstructionArgs,
    ) -> solana_instruction::Instruction {
        self.instruction_with_remaining_accounts(args, &[])
    }
    #[allow(clippy::arithmetic_side_effects)]
    #[allow(clippy::vec_init_then_push)]
    pub fn instruction_with_remaining_accounts(
        &self,
        args: TrimVerificationConfigInstructionArgs,
        remaining_accounts: &[solana_instruction::AccountMeta],
    ) -> solana_instruction::Instruction {
        let mut accounts = Vec::with_capacity(10 + remaining_accounts.len());
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            self.mint, false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            self.verification_config_or_mint_authority,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            self.instructions_sysvar_or_creator,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            self.mint_account,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new(
            self.config_account,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new(self.recipient, false));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            self.system_program,
            false,
        ));
        if let Some(account_metas_pda) = self.account_metas_pda {
            accounts.push(solana_instruction::AccountMeta::new(
                account_metas_pda,
                false,
            ));
        } else {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                crate::SECURITY_TOKEN_PROGRAM_ID,
                false,
            ));
        }
        if let Some(transfer_hook_pda) = self.transfer_hook_pda {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                transfer_hook_pda,
                false,
            ));
        } else {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                crate::SECURITY_TOKEN_PROGRAM_ID,
                false,
            ));
        }
        if let Some(transfer_hook_program) = self.transfer_hook_program {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                transfer_hook_program,
                false,
            ));
        } else {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                crate::SECURITY_TOKEN_PROGRAM_ID,
                false,
            ));
        }
        accounts.extend_from_slice(remaining_accounts);
        let mut data = borsh::to_vec(&TrimVerificationConfigInstructionData::new()).unwrap();
        let mut args = borsh::to_vec(&args).unwrap();
        data.append(&mut args);

        solana_instruction::Instruction {
            program_id: crate::SECURITY_TOKEN_PROGRAM_ID,
            accounts,
            data,
        }
    }
}

#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TrimVerificationConfigInstructionData {
    discriminator: u8,
}

impl TrimVerificationConfigInstructionData {
    pub fn new() -> Self {
        Self { discriminator: 4 }
    }
}

impl Default for TrimVerificationConfigInstructionData {
    fn default() -> Self {
        Self::new()
    }
}

#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TrimVerificationConfigInstructionArgs {
    pub trim_verification_config_args: TrimVerificationConfigArgs,
}

/// Instruction builder for `TrimVerificationConfig`.
///
/// ### Accounts:
///
///   0. `[]` mint
///   1. `[]` verification_config_or_mint_authority
///   2. `[]` instructions_sysvar_or_creator
///   3. `[]` mint_account
///   4. `[writable]` config_account
///   5. `[writable]` recipient
///   6. `[optional]` system_program (default to `11111111111111111111111111111111`)
///   7. `[writable, optional]` account_metas_pda
///   8. `[optional]` transfer_hook_pda
///   9. `[optional]` transfer_hook_program
#[derive(Clone, Debug, Default)]
pub struct TrimVerificationConfigBuilder {
    mint: Option<solana_pubkey::Pubkey>,
    verification_config_or_mint_authority: Option<solana_pubkey::Pubkey>,
    instructions_sysvar_or_creator: Option<solana_pubkey::Pubkey>,
    mint_account: Option<solana_pubkey::Pubkey>,
    config_account: Option<solana_pubkey::Pubkey>,
    recipient: Option<solana_pubkey::Pubkey>,
    system_program: Option<solana_pubkey::Pubkey>,
    account_metas_pda: Option<solana_pubkey::Pubkey>,
    transfer_hook_pda: Option<solana_pubkey::Pubkey>,
    transfer_hook_program: Option<solana_pubkey::Pubkey>,
    trim_verification_config_args: Option<TrimVerificationConfigArgs>,
    __remaining_accounts: Vec<solana_instruction::AccountMeta>,
}

impl TrimVerificationConfigBuilder {
    pub fn new() -> Self {
        Self::default()
    }
    #[inline(always)]
    pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self {
        self.mint = Some(mint);
        self
    }
    #[inline(always)]
    pub fn verification_config_or_mint_authority(
        &mut self,
        verification_config_or_mint_authority: solana_pubkey::Pubkey,
    ) -> &mut Self {
        self.verification_config_or_mint_authority = Some(verification_config_or_mint_authority);
        self
    }
    #[inline(always)]
    pub fn instructions_sysvar_or_creator(
        &mut self,
        instructions_sysvar_or_creator: solana_pubkey::Pubkey,
    ) -> &mut Self {
        self.instructions_sysvar_or_creator = Some(instructions_sysvar_or_creator);
        self
    }
    #[inline(always)]
    pub fn mint_account(&mut self, mint_account: solana_pubkey::Pubkey) -> &mut Self {
        self.mint_account = Some(mint_account);
        self
    }
    #[inline(always)]
    pub fn config_account(&mut self, config_account: solana_pubkey::Pubkey) -> &mut Self {
        self.config_account = Some(config_account);
        self
    }
    #[inline(always)]
    pub fn recipient(&mut self, recipient: solana_pubkey::Pubkey) -> &mut Self {
        self.recipient = Some(recipient);
        self
    }
    /// `[optional account, default to '11111111111111111111111111111111']`
    #[inline(always)]
    pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self {
        self.system_program = Some(system_program);
        self
    }
    /// `[optional account]`
    #[inline(always)]
    pub fn account_metas_pda(
        &mut self,
        account_metas_pda: Option<solana_pubkey::Pubkey>,
    ) -> &mut Self {
        self.account_metas_pda = account_metas_pda;
        self
    }
    /// `[optional account]`
    #[inline(always)]
    pub fn transfer_hook_pda(
        &mut self,
        transfer_hook_pda: Option<solana_pubkey::Pubkey>,
    ) -> &mut Self {
        self.transfer_hook_pda = transfer_hook_pda;
        self
    }
    /// `[optional account]`
    #[inline(always)]
    pub fn transfer_hook_program(
        &mut self,
        transfer_hook_program: Option<solana_pubkey::Pubkey>,
    ) -> &mut Self {
        self.transfer_hook_program = transfer_hook_program;
        self
    }
    #[inline(always)]
    pub fn trim_verification_config_args(
        &mut self,
        trim_verification_config_args: TrimVerificationConfigArgs,
    ) -> &mut Self {
        self.trim_verification_config_args = Some(trim_verification_config_args);
        self
    }
    /// Add an additional account to the instruction.
    #[inline(always)]
    pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
        self.__remaining_accounts.push(account);
        self
    }
    /// Add additional accounts to the instruction.
    #[inline(always)]
    pub fn add_remaining_accounts(
        &mut self,
        accounts: &[solana_instruction::AccountMeta],
    ) -> &mut Self {
        self.__remaining_accounts.extend_from_slice(accounts);
        self
    }
    #[allow(clippy::clone_on_copy)]
    pub fn instruction(&self) -> solana_instruction::Instruction {
        let accounts = TrimVerificationConfig {
            mint: self.mint.expect("mint is not set"),
            verification_config_or_mint_authority: self
                .verification_config_or_mint_authority
                .expect("verification_config_or_mint_authority is not set"),
            instructions_sysvar_or_creator: self
                .instructions_sysvar_or_creator
                .expect("instructions_sysvar_or_creator is not set"),
            mint_account: self.mint_account.expect("mint_account is not set"),
            config_account: self.config_account.expect("config_account is not set"),
            recipient: self.recipient.expect("recipient is not set"),
            system_program: self
                .system_program
                .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")),
            account_metas_pda: self.account_metas_pda,
            transfer_hook_pda: self.transfer_hook_pda,
            transfer_hook_program: self.transfer_hook_program,
        };
        let args = TrimVerificationConfigInstructionArgs {
            trim_verification_config_args: self
                .trim_verification_config_args
                .clone()
                .expect("trim_verification_config_args is not set"),
        };

        accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
    }
}

/// `trim_verification_config` CPI accounts.
pub struct TrimVerificationConfigCpiAccounts<'a, 'b> {
    pub mint: &'b solana_account_info::AccountInfo<'a>,

    pub verification_config_or_mint_authority: &'b solana_account_info::AccountInfo<'a>,

    pub instructions_sysvar_or_creator: &'b solana_account_info::AccountInfo<'a>,

    pub mint_account: &'b solana_account_info::AccountInfo<'a>,

    pub config_account: &'b solana_account_info::AccountInfo<'a>,

    pub recipient: &'b solana_account_info::AccountInfo<'a>,

    pub system_program: &'b solana_account_info::AccountInfo<'a>,

    pub account_metas_pda: Option<&'b solana_account_info::AccountInfo<'a>>,

    pub transfer_hook_pda: Option<&'b solana_account_info::AccountInfo<'a>>,

    pub transfer_hook_program: Option<&'b solana_account_info::AccountInfo<'a>>,
}

/// `trim_verification_config` CPI instruction.
pub struct TrimVerificationConfigCpi<'a, 'b> {
    /// The program to invoke.
    pub __program: &'b solana_account_info::AccountInfo<'a>,

    pub mint: &'b solana_account_info::AccountInfo<'a>,

    pub verification_config_or_mint_authority: &'b solana_account_info::AccountInfo<'a>,

    pub instructions_sysvar_or_creator: &'b solana_account_info::AccountInfo<'a>,

    pub mint_account: &'b solana_account_info::AccountInfo<'a>,

    pub config_account: &'b solana_account_info::AccountInfo<'a>,

    pub recipient: &'b solana_account_info::AccountInfo<'a>,

    pub system_program: &'b solana_account_info::AccountInfo<'a>,

    pub account_metas_pda: Option<&'b solana_account_info::AccountInfo<'a>>,

    pub transfer_hook_pda: Option<&'b solana_account_info::AccountInfo<'a>>,

    pub transfer_hook_program: Option<&'b solana_account_info::AccountInfo<'a>>,
    /// The arguments for the instruction.
    pub __args: TrimVerificationConfigInstructionArgs,
}

impl<'a, 'b> TrimVerificationConfigCpi<'a, 'b> {
    pub fn new(
        program: &'b solana_account_info::AccountInfo<'a>,
        accounts: TrimVerificationConfigCpiAccounts<'a, 'b>,
        args: TrimVerificationConfigInstructionArgs,
    ) -> Self {
        Self {
            __program: program,
            mint: accounts.mint,
            verification_config_or_mint_authority: accounts.verification_config_or_mint_authority,
            instructions_sysvar_or_creator: accounts.instructions_sysvar_or_creator,
            mint_account: accounts.mint_account,
            config_account: accounts.config_account,
            recipient: accounts.recipient,
            system_program: accounts.system_program,
            account_metas_pda: accounts.account_metas_pda,
            transfer_hook_pda: accounts.transfer_hook_pda,
            transfer_hook_program: accounts.transfer_hook_program,
            __args: args,
        }
    }
    #[inline(always)]
    pub fn invoke(&self) -> solana_program_error::ProgramResult {
        self.invoke_signed_with_remaining_accounts(&[], &[])
    }
    #[inline(always)]
    pub fn invoke_with_remaining_accounts(
        &self,
        remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)],
    ) -> solana_program_error::ProgramResult {
        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
    }
    #[inline(always)]
    pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
    }
    #[allow(clippy::arithmetic_side_effects)]
    #[allow(clippy::clone_on_copy)]
    #[allow(clippy::vec_init_then_push)]
    pub fn invoke_signed_with_remaining_accounts(
        &self,
        signers_seeds: &[&[&[u8]]],
        remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)],
    ) -> solana_program_error::ProgramResult {
        let mut accounts = Vec::with_capacity(10 + remaining_accounts.len());
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            *self.mint.key,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            *self.verification_config_or_mint_authority.key,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            *self.instructions_sysvar_or_creator.key,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            *self.mint_account.key,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new(
            *self.config_account.key,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new(
            *self.recipient.key,
            false,
        ));
        accounts.push(solana_instruction::AccountMeta::new_readonly(
            *self.system_program.key,
            false,
        ));
        if let Some(account_metas_pda) = self.account_metas_pda {
            accounts.push(solana_instruction::AccountMeta::new(
                *account_metas_pda.key,
                false,
            ));
        } else {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                crate::SECURITY_TOKEN_PROGRAM_ID,
                false,
            ));
        }
        if let Some(transfer_hook_pda) = self.transfer_hook_pda {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                *transfer_hook_pda.key,
                false,
            ));
        } else {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                crate::SECURITY_TOKEN_PROGRAM_ID,
                false,
            ));
        }
        if let Some(transfer_hook_program) = self.transfer_hook_program {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                *transfer_hook_program.key,
                false,
            ));
        } else {
            accounts.push(solana_instruction::AccountMeta::new_readonly(
                crate::SECURITY_TOKEN_PROGRAM_ID,
                false,
            ));
        }
        remaining_accounts.iter().for_each(|remaining_account| {
            accounts.push(solana_instruction::AccountMeta {
                pubkey: *remaining_account.0.key,
                is_signer: remaining_account.1,
                is_writable: remaining_account.2,
            })
        });
        let mut data = borsh::to_vec(&TrimVerificationConfigInstructionData::new()).unwrap();
        let mut args = borsh::to_vec(&self.__args).unwrap();
        data.append(&mut args);

        let instruction = solana_instruction::Instruction {
            program_id: crate::SECURITY_TOKEN_PROGRAM_ID,
            accounts,
            data,
        };
        let mut account_infos = Vec::with_capacity(11 + remaining_accounts.len());
        account_infos.push(self.__program.clone());
        account_infos.push(self.mint.clone());
        account_infos.push(self.verification_config_or_mint_authority.clone());
        account_infos.push(self.instructions_sysvar_or_creator.clone());
        account_infos.push(self.mint_account.clone());
        account_infos.push(self.config_account.clone());
        account_infos.push(self.recipient.clone());
        account_infos.push(self.system_program.clone());
        if let Some(account_metas_pda) = self.account_metas_pda {
            account_infos.push(account_metas_pda.clone());
        }
        if let Some(transfer_hook_pda) = self.transfer_hook_pda {
            account_infos.push(transfer_hook_pda.clone());
        }
        if let Some(transfer_hook_program) = self.transfer_hook_program {
            account_infos.push(transfer_hook_program.clone());
        }
        remaining_accounts
            .iter()
            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));

        if signers_seeds.is_empty() {
            solana_cpi::invoke(&instruction, &account_infos)
        } else {
            solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
        }
    }
}

/// Instruction builder for `TrimVerificationConfig` via CPI.
///
/// ### Accounts:
///
///   0. `[]` mint
///   1. `[]` verification_config_or_mint_authority
///   2. `[]` instructions_sysvar_or_creator
///   3. `[]` mint_account
///   4. `[writable]` config_account
///   5. `[writable]` recipient
///   6. `[]` system_program
///   7. `[writable, optional]` account_metas_pda
///   8. `[optional]` transfer_hook_pda
///   9. `[optional]` transfer_hook_program
#[derive(Clone, Debug)]
pub struct TrimVerificationConfigCpiBuilder<'a, 'b> {
    instruction: Box<TrimVerificationConfigCpiBuilderInstruction<'a, 'b>>,
}

impl<'a, 'b> TrimVerificationConfigCpiBuilder<'a, 'b> {
    pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
        let instruction = Box::new(TrimVerificationConfigCpiBuilderInstruction {
            __program: program,
            mint: None,
            verification_config_or_mint_authority: None,
            instructions_sysvar_or_creator: None,
            mint_account: None,
            config_account: None,
            recipient: None,
            system_program: None,
            account_metas_pda: None,
            transfer_hook_pda: None,
            transfer_hook_program: None,
            trim_verification_config_args: None,
            __remaining_accounts: Vec::new(),
        });
        Self { instruction }
    }
    #[inline(always)]
    pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
        self.instruction.mint = Some(mint);
        self
    }
    #[inline(always)]
    pub fn verification_config_or_mint_authority(
        &mut self,
        verification_config_or_mint_authority: &'b solana_account_info::AccountInfo<'a>,
    ) -> &mut Self {
        self.instruction.verification_config_or_mint_authority =
            Some(verification_config_or_mint_authority);
        self
    }
    #[inline(always)]
    pub fn instructions_sysvar_or_creator(
        &mut self,
        instructions_sysvar_or_creator: &'b solana_account_info::AccountInfo<'a>,
    ) -> &mut Self {
        self.instruction.instructions_sysvar_or_creator = Some(instructions_sysvar_or_creator);
        self
    }
    #[inline(always)]
    pub fn mint_account(
        &mut self,
        mint_account: &'b solana_account_info::AccountInfo<'a>,
    ) -> &mut Self {
        self.instruction.mint_account = Some(mint_account);
        self
    }
    #[inline(always)]
    pub fn config_account(
        &mut self,
        config_account: &'b solana_account_info::AccountInfo<'a>,
    ) -> &mut Self {
        self.instruction.config_account = Some(config_account);
        self
    }
    #[inline(always)]
    pub fn recipient(&mut self, recipient: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
        self.instruction.recipient = Some(recipient);
        self
    }
    #[inline(always)]
    pub fn system_program(
        &mut self,
        system_program: &'b solana_account_info::AccountInfo<'a>,
    ) -> &mut Self {
        self.instruction.system_program = Some(system_program);
        self
    }
    /// `[optional account]`
    #[inline(always)]
    pub fn account_metas_pda(
        &mut self,
        account_metas_pda: Option<&'b solana_account_info::AccountInfo<'a>>,
    ) -> &mut Self {
        self.instruction.account_metas_pda = account_metas_pda;
        self
    }
    /// `[optional account]`
    #[inline(always)]
    pub fn transfer_hook_pda(
        &mut self,
        transfer_hook_pda: Option<&'b solana_account_info::AccountInfo<'a>>,
    ) -> &mut Self {
        self.instruction.transfer_hook_pda = transfer_hook_pda;
        self
    }
    /// `[optional account]`
    #[inline(always)]
    pub fn transfer_hook_program(
        &mut self,
        transfer_hook_program: Option<&'b solana_account_info::AccountInfo<'a>>,
    ) -> &mut Self {
        self.instruction.transfer_hook_program = transfer_hook_program;
        self
    }
    #[inline(always)]
    pub fn trim_verification_config_args(
        &mut self,
        trim_verification_config_args: TrimVerificationConfigArgs,
    ) -> &mut Self {
        self.instruction.trim_verification_config_args = Some(trim_verification_config_args);
        self
    }
    /// Add an additional account to the instruction.
    #[inline(always)]
    pub fn add_remaining_account(
        &mut self,
        account: &'b solana_account_info::AccountInfo<'a>,
        is_writable: bool,
        is_signer: bool,
    ) -> &mut Self {
        self.instruction
            .__remaining_accounts
            .push((account, is_writable, is_signer));
        self
    }
    /// Add additional accounts to the instruction.
    ///
    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
    /// and a `bool` indicating whether the account is a signer or not.
    #[inline(always)]
    pub fn add_remaining_accounts(
        &mut self,
        accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)],
    ) -> &mut Self {
        self.instruction
            .__remaining_accounts
            .extend_from_slice(accounts);
        self
    }
    #[inline(always)]
    pub fn invoke(&self) -> solana_program_error::ProgramResult {
        self.invoke_signed(&[])
    }
    #[allow(clippy::clone_on_copy)]
    #[allow(clippy::vec_init_then_push)]
    pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
        let args = TrimVerificationConfigInstructionArgs {
            trim_verification_config_args: self
                .instruction
                .trim_verification_config_args
                .clone()
                .expect("trim_verification_config_args is not set"),
        };
        let instruction = TrimVerificationConfigCpi {
            __program: self.instruction.__program,

            mint: self.instruction.mint.expect("mint is not set"),

            verification_config_or_mint_authority: self
                .instruction
                .verification_config_or_mint_authority
                .expect("verification_config_or_mint_authority is not set"),

            instructions_sysvar_or_creator: self
                .instruction
                .instructions_sysvar_or_creator
                .expect("instructions_sysvar_or_creator is not set"),

            mint_account: self
                .instruction
                .mint_account
                .expect("mint_account is not set"),

            config_account: self
                .instruction
                .config_account
                .expect("config_account is not set"),

            recipient: self.instruction.recipient.expect("recipient is not set"),

            system_program: self
                .instruction
                .system_program
                .expect("system_program is not set"),

            account_metas_pda: self.instruction.account_metas_pda,

            transfer_hook_pda: self.instruction.transfer_hook_pda,

            transfer_hook_program: self.instruction.transfer_hook_program,
            __args: args,
        };
        instruction.invoke_signed_with_remaining_accounts(
            signers_seeds,
            &self.instruction.__remaining_accounts,
        )
    }
}

#[derive(Clone, Debug)]
struct TrimVerificationConfigCpiBuilderInstruction<'a, 'b> {
    __program: &'b solana_account_info::AccountInfo<'a>,
    mint: Option<&'b solana_account_info::AccountInfo<'a>>,
    verification_config_or_mint_authority: Option<&'b solana_account_info::AccountInfo<'a>>,
    instructions_sysvar_or_creator: Option<&'b solana_account_info::AccountInfo<'a>>,
    mint_account: Option<&'b solana_account_info::AccountInfo<'a>>,
    config_account: Option<&'b solana_account_info::AccountInfo<'a>>,
    recipient: Option<&'b solana_account_info::AccountInfo<'a>>,
    system_program: Option<&'b solana_account_info::AccountInfo<'a>>,
    account_metas_pda: Option<&'b solana_account_info::AccountInfo<'a>>,
    transfer_hook_pda: Option<&'b solana_account_info::AccountInfo<'a>>,
    transfer_hook_program: Option<&'b solana_account_info::AccountInfo<'a>>,
    trim_verification_config_args: Option<TrimVerificationConfigArgs>,
    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
    __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
}
