contract Anim_Ape is ERC721A, Ownable, ReentrancyGuard{
    uint256 public constant maxSupply = 10000;
    uint256 public maxBuyPerTx = 5;
    bool public paused;
    

    constructor() ERC721A("Anim Ape", "AmA") {
        paused = true;
    }

    function updatePrice(uint256 _supply) internal pure returns (uint256){
        if(_supply < 1000){
            return 0.1 ether;
        } else if(_supply < 9000){
            return 0.2 ether;
        } else{
            return 0.3 ether;
        }
    }
    function apePrice() view public returns (uint256){
        return updatePrice(totalSupply());
    }

    modifier mintCompliance(uint256 _mintAmount) {
    require(_mintAmount > 0 && _mintAmount <= maxBuyPerTx, "Invalid buy amount");
    require(totalSupply() + _mintAmount <= maxSupply, "No more Apes");
    _;
    }

    function buyApes(uint256 _mintAmount) external payable mintCompliance(_mintAmount) {
        require(paused == false, "Must paused");
        require(msg.value >= updatePrice(totalSupply()) * _mintAmount, "Not enough funds");
        _safeMint(msg.sender, _mintAmount);
    }

		// Mints for Mysthereum
    function devApes(uint256 _qty) external onlyOwner {
        require(paused == true, "Must paused");
        _safeMint(msg.sender, _qty);
    }

  function withdraw(address _ad1, uint256 _perc) external onlyOwner nonReentrant{
    (bool hs, ) = payable(_ad1).call{value: address(this).balance * _perc / 100}("");
    require(hs);
    (bool os, ) = payable(owner()).call{value: address(this).balance}("");
    require(os);
  }

    // metadata URI
    string private _baseTokenURI;

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

    function setBaseURI(string calldata baseURI) external onlyOwner {
        _baseTokenURI = baseURI;
    }

    // Pause & Unpause
    function setPaused(bool _paused) external onlyOwner {
    paused = _paused;
    }
}
function devApes(uint256 _qty) external onlyOwner {
    require(paused == true, "Must paused");
    _safeMint(msg.sender, _qty);
}

// Mints for Mysthereum