contract Theilluminatinfts is ERC721Enumerable, Ownable {
    uint256 public tokenCounter = 0;
    uint256 public cost = 0.069 ether;
    bool public paused = false;

    mapping(uint256 => string) public hashes;
    string public baseURI;

    constructor() ERC721("Illuminati", "ILLUMINATI") {
        setBaseURI("https://ipfs.io/ipfs/");
    }

    // internal
    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }

    function createCollectible(string[] memory tokenURIArr) public payable {
        require(!paused);
        require(tokenURIArr.length > 0);

        if (msg.sender != owner()) {
            require(msg.value >= cost * tokenURIArr.length);
        }

        for (uint256 i = 0; i < tokenURIArr.length; i++) {
            uint256 newItemId = tokenCounter;
            _safeMint(msg.sender, newItemId);
            hashes[newItemId] = tokenURIArr[i];
            tokenCounter += 1;
        }

        payable(owner()).transfer(msg.value);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        string memory currentBaseURI = _baseURI();
        return
            bytes(currentBaseURI).length > 0
                ? string(abi.encodePacked(currentBaseURI, hashes[tokenId]))
                : "";
    }

    function setCost(uint256 _newCost) public onlyOwner {
        cost = _newCost;
    }

    function setBaseURI(string memory _newBaseURI) public onlyOwner {
        baseURI = _newBaseURI;
    }

    function pause(bool _state) public onlyOwner {
        paused = _state;
    }

    // function withdraw() public payable onlyOwner {
    //     require(payable(msg.sender).send(address(this).balance));
    // }
}
function _baseURI() internal view virtual override returns (string memory) {
    return baseURI;
}

// internal