use candid::CandidType;
use serde::Deserialize;
use crate::identity::{AccountIdentifier, AccountIdentifierHex, UserId, UserIdHex};
pub use super::storage::{NftStorage, NftStorageState};
#[cfg(feature = "nft_ext")]
pub use super::ext::types::*;
#[cfg(feature = "nft_ticket")]
pub use super::ticket::{ForbiddenDuration, NftTicket, NftTicketState, NftTicketStatus};
#[cfg(feature = "nft_limit")]
pub use super::limit::{LimitDuration, NftLimit, NftLimitState};
#[derive(CandidType, Deserialize, Default, Debug, Clone)]
pub struct InnerData {
pub headers: Vec<(String, String)>,
pub data: Vec<u8>, }
#[derive(CandidType, Deserialize, Default, Debug, Clone)]
pub struct OuterData {
pub headers: Vec<(String, String)>,
pub url: String, }
#[derive(CandidType, Deserialize, Debug, Clone)]
pub enum MediaData {
Inner(InnerData),
Outer(OuterData),
}
#[derive(CandidType, Deserialize, Debug, Default)]
pub struct NFTInfo {
pub name: String, pub symbol: String, pub logo: Option<MediaData>, pub thumbnail: Option<MediaData>, pub maintaining: Option<MediaData>, }
#[derive(CandidType, Deserialize, Debug, Clone)]
pub enum NFTOwnable {
None,
Text(String),
Media(MediaData),
Data(Vec<u8>),
List(Vec<NFTOwnable>),
}
#[derive(CandidType, Deserialize, Debug)]
pub struct Nft {
pub index: usize, pub name: String, pub owner: AccountIdentifier, pub approved: Option<UserId>, pub rarity: String, pub content: Option<Vec<u8>>, pub metadata: Vec<MediaData>, pub thumbnail: Option<MediaData>, pub ownable: NFTOwnable, }
#[derive(CandidType, Deserialize, Debug)]
pub struct NftView {
pub name: String, pub owner: AccountIdentifierHex, pub approved: Option<UserIdHex>, }