import { isOriginalEditionAccount, } from '../accounts';
import { toBigNumber, toOptionBigNumber } from '../../../types';
import { assert } from '../../../utils';
/** @group Model Helpers */
export const isNftEdition = (value) => typeof value === 'object' && value.model === 'nftEdition';
/** @group Model Helpers */
export function assertNftEdition(value) {
    assert(isNftEdition(value), `Expected NftEdition model`);
}
/** @group Model Helpers */
export const toNftEdition = (account) => isOriginalEditionAccount(account)
    ? toNftOriginalEdition(account)
    : toNftPrintEdition(account);
/** @group Model Helpers */
export const isNftOriginalEdition = (value) => isNftEdition(value) && value.isOriginal;
/** @group Model Helpers */
export function assertNftOriginalEdition(value) {
    assert(isNftOriginalEdition(value), `Expected NftOriginalEdition model`);
}
/** @group Model Helpers */
export const toNftOriginalEdition = (account) => ({
    model: 'nftEdition',
    isOriginal: true,
    address: account.publicKey,
    supply: toBigNumber(account.data.supply),
    maxSupply: toOptionBigNumber(account.data.maxSupply),
});
/** @group Model Helpers */
export const isNftPrintEdition = (value) => isNftEdition(value) && !value.isOriginal;
/** @group Model Helpers */
export function assertNftPrintEdition(value) {
    assert(isNftPrintEdition(value), `Expected NftPrintEdition model`);
}
/** @group Model Helpers */
export const toNftPrintEdition = (account) => ({
    model: 'nftEdition',
    isOriginal: false,
    address: account.publicKey,
    parent: account.data.parent,
    number: toBigNumber(account.data.edition),
});
//# sourceMappingURL=NftEdition.js.map