use borsh::{BorshDeserialize, BorshSerialize};
use shank::{ShankContext, ShankInstruction};
pub use crate::generated::{
types::{DelegateRole, ExtensionType, Standard},
*,
};
#[derive(BorshDeserialize, BorshSerialize, Clone, Debug, ShankInstruction, ShankContext)]
#[rustfmt::skip]
pub enum Interface {
#[account(0, signer, writable, name="buffer", desc = "The unitialized buffer account")]
#[account(1, writable, name="recipient", desc = "The account receiving refunded rent")]
Close,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, writable, name="signer", desc = "The owner or burn delegate of the asset")]
#[account(2, optional, writable, name="recipient", desc = "The account receiving refunded rent")]
#[account(3, optional, writable, name="group", desc = "Asset account of the group")]
Burn,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, optional_signer, name="authority", desc = "The authority of the asset")]
#[account(2, name="owner", desc = "The owner of the asset")]
#[account(3, optional, writable, name="group", desc = "Asset account of the group")]
#[account(4, optional, signer, name="group_authority", desc = "The delegate authority for minting assets into a group")]
#[account(5, optional, signer, writable, name="payer", desc = "The account paying for the storage fees")]
#[account(6, optional, name="system_program", desc = "The system program")]
Create(MetadataInput),
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="owner", desc = "The owner of the asset")]
#[account(2, name="delegate", desc = "The delegate account")]
Approve(DelegateInput),
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, optional, signer, writable, name="payer", desc = "The account paying for the storage fees")]
#[account(2, optional, name="system_program", desc = "The system program")]
Allocate(AllocateInput),
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="signer", desc = "Delegate or owner account")]
Lock,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="signer", desc = "Current owner of the asset or delegate")]
Revoke(DelegateInput),
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="signer", desc = "Current owner of the asset or transfer delegate")]
#[account(2, name="recipient", desc = "The recipient of the asset")]
#[account(3, optional, name="group", desc = "The asset defining the group, if applicable")]
Transfer,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="signer", desc = "Delegate or owner account")]
Unlock,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="creator", desc = "Creator account to unverify")]
Unverify,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="authority", desc = "The authority of the asset")]
#[account(2, optional, writable, name="buffer", desc = "Extension (asset) buffer account")]
#[account(3, optional, name="group", desc = "The asset defining the group, if applicable")]
#[account(4, optional, signer, writable, name="payer", desc = "The account paying for the storage fees")]
#[account(5, optional, name="system_program", desc = "The system program")]
Update(UpdateInput),
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="creator", desc = "Creator account to verify")]
Verify,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, writable, name="payer", desc = "The account paying for the storage fees")]
#[account(2, name="system_program", desc = "The system program")]
Write(DataInput),
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, writable, name="group", desc = "Asset account of the group")]
#[account(2, signer, name="authority", desc = "The authority of the assets")]
Group,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, writable, name="group", desc = "Asset account of the group")]
#[account(2, signer, name="authority", desc = "The authority of the assets")]
Ungroup,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="authority", desc = "The authority of the asset")]
#[account(2, signer, name="new_authority", desc = "The new authority of the asset")]
Handover,
#[account(0, signer, writable, name="asset", desc = "Asset account")]
#[account(1, signer, name="authority", desc = "The authority of the asset")]
#[account(2, optional, name="group", desc = "The asset defining the group, if applicable")]
#[account(3, writable, name="recipient", desc = "The account receiving refunded rent")]
Remove(ExtensionType),
}
#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
pub struct AllocateInput {
pub extension: ExtensionInput,
}
#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, PartialEq)]
pub enum DelegateInput {
All,
Some { roles: Vec<DelegateRole> },
}
#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
pub struct DataInput {
pub overwrite: bool,
pub bytes: Vec<u8>,
}
#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
pub struct ExtensionInput {
pub extension_type: ExtensionType,
pub length: u32,
pub data: Option<Vec<u8>>,
}
#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
pub struct MetadataInput {
pub name: String,
pub standard: Standard,
pub mutable: bool,
pub extensions: Option<Vec<ExtensionInput>>,
}
#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
pub struct UpdateInput {
pub name: Option<String>,
pub mutable: Option<bool>,
pub extension: Option<ExtensionInput>,
}