contract RASCManager is Ownable, Pausable, ERC721SingleCreatorExtension, ERC721CreatorExtensionApproveTransfer {
    
    //address private _creator;
    uint256 private _minted;

    //event ApprovalCheck(address from, address to, uint256 tokenId);

    constructor(address creator_) ERC721SingleCreatorExtension(creator_)  { _minted = 0; }

    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == 
            type(ICreatorExtensionTokenURI).interfaceId || 
            AdminControl.supportsInterface(interfaceId) ||
            ERC721CreatorExtensionApproveTransfer.supportsInterface(interfaceId);
    }

    function pause() external adminRequired {
        _pause();
    }

    function unpause() external adminRequired {
        _unpause();
    }

    function approveTransfer(address from, address to, uint256 tokenId) external override returns (bool) {
        require(msg.sender == _creator, "Invalid caller");

        // can't mint or transfer if this contract is paused (unless minting or sending to admin)
        require(!paused() || isAdmin(to) || isAdmin(from), "Tokens aren't transferable now");

        //emit ApprovalCheck(from, to, tokenId);

        return true;
    }

    function setBaseTokenURI(string calldata uri, bool identical) external adminRequired {
        IERC721CreatorCore(_creator).setBaseTokenURIExtension(uri, identical);
    }

    function setTokenURI(uint256[] calldata tokenIds, string[] calldata uris) external adminRequired {
        IERC721CreatorCore(_creator).setTokenURIExtension(tokenIds, uris);
    }    

    function setTokenURIPrefix(string calldata prefix) external onlyOwner {
        IERC721CreatorCore(_creator).setTokenURIPrefixExtension(prefix);
    }

    // Make sure draft tokens are already set up in Manifold Studio and get their metadata URIs prior to bulk minting        
    function airdropURIs(address[] calldata receivers, string[] calldata uris) external adminRequired {
        require(receivers.length == uris.length, "Length mismatch");

        for (uint i = 0; i < receivers.length; i++) {
            IERC721CreatorCore(_creator).mintExtension(receivers[i], uris[i]);
        }
        _minted += receivers.length;
    }

    function numMinted() external view returns (uint256)
    {
        return _minted;
    }
}
/**
 * TokenManager handles airdropping and transfer restrictions for Radix Art Social Club tokens.
 */
function airdropURIs(address[] calldata receivers, string[] calldata uris) external adminRequired {
    require(receivers.length == uris.length, "Length mismatch");

    for (uint i = 0; i < receivers.length; i++) {
        IERC721CreatorCore(_creator).mintExtension(receivers[i], uris[i]);
    }
    _minted += receivers.length;
}

// Make sure draft tokens are already set up in Manifold Studio and get their metadata URIs prior to bulk minting        