contract CopyCats is ERC721Enumerable, Ownable {
    string _baseTokenURI;
    uint256 private _maxMint = 20;
    uint256 private _price = 5 * 10**16; //0.05 ETH;
    bool public _paused = true;
    uint public constant MAX_ENTRIES = 9999;

    constructor(string memory baseURI) ERC721("CopyCats", "COPYCATS")  {
        setBaseURI(baseURI);
    }

    function mint(address _to, uint256 num) public payable {
        uint256 supply = totalSupply();
        if(msg.sender != owner()) {
          require(!_paused, "Sale Paused");
          require( num < (_maxMint+1),"You can mint a maximum of _maxMint CopyCats" );
          require( msg.value >= _price * num,"Ether sent is not correct" );
        }

        require( supply + num < MAX_ENTRIES + 1,            "Exceeds maximum supply" );
        for(uint256 i; i < num; i++){
          _safeMint( _to, supply + i );
        }
    }

    function walletOfOwner(address _owner) public view returns(uint256[] memory) {
        uint256 tokenCount = balanceOf(_owner);

        uint256[] memory tokensId = new uint256[](tokenCount);
        for(uint256 i; i < tokenCount; i++){
            tokensId[i] = tokenOfOwnerByIndex(_owner, i);
        }
        return tokensId;
    }

    function getPrice() public view returns (uint256){
        if(msg.sender == owner()) {
            return 0;
        }
        return _price;
    }

    // Just in case Eth does some crazy stuff
    function setPrice(uint256 _newPrice) public onlyOwner() {
        _price = _newPrice;
    }

    function getMaxMint() public view returns (uint256){
        return _maxMint;
    }

    function setMaxMint(uint256 _newMaxMint) public onlyOwner() {
        _maxMint = _newMaxMint;
    }

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

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

    function pause(bool val) public onlyOwner {
        _paused = val;
    }

    function withdrawAll() public payable onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }
}
function setPrice(uint256 _newPrice) public onlyOwner() {
    _price = _newPrice;
}

// Just in case Eth does some crazy stuff