// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

contract Pepe {
    
    address payable public creator;
    uint256 public totalSupply;
    string public UnrevealedURI;
    string public RevealedURI;
    bool public isRevealed = false;
    mapping(address => uint256) public walletTokenCount;
    mapping(uint256 => address) public tokenOwners;
    mapping(uint256 => string) public tokenURIs;

    constructor(string memory _UnrevealedURI) {
        creator = payable(msg.sender);
        UnrevealedURI = _UnrevealedURI;
    }

    function mint() public payable {
        require(msg.value == 0.01 ether, "Not correct amount of ETH sent");
        require(walletTokenCount[msg.sender] < 10, "Cannot mint more than 10 tokens per wallet");

        totalSupply += 1;
        walletTokenCount[msg.sender] += 1;
        tokenOwners[totalSupply] = msg.sender;
        tokenURIs[totalSupply] = UnrevealedURI;
    }

    function setRevealedURI(string memory _RevealedURI) public {
        require(msg.sender == creator, "Only the creator can set the revealed URI");
        RevealedURI = _RevealedURI;
    }

    function RevealNFT() public {
        require(msg.sender == creator, "Only the creator can reveal the NFT");
        isRevealed = true;

        for(uint i = 1; i <= totalSupply; i++) {
            tokenURIs[i] = RevealedURI;
        }
    }

    function tokenURI(uint256 tokenId) public view returns (string memory) {
        require(tokenOwners[tokenId] != address(0), "Invalid tokenId");
        return tokenURIs[tokenId];
    }

    function withdraw() public {
        require(msg.sender == creator, "Only the creator can withdraw funds");
        creator.transfer(address(this).balance);
    }
}