contract rugimalsPFP is Ownable, ERC721A {

    // OG List :: previous supporters, get NFTs for free (gas only)
    // Whitelist :: marketed supporters, get sales price and advanced purchase
    // Public sale :: regular price, till they all sell

    uint public max_supply = 1350;

    uint public public_max = 3;

    uint public public_price = 0.0 ether;

    bool public public_sale_status = true;

    uint public total_supply = 0;

    string public baseURI = "ipfs://QmcJ3UPkuhknkL8rswdtw25osqGeP12vHUUSEJFBRTWYwQ/";

    constructor() ERC721A("Rugimals PFP", "RPFP"){}

    function buy(uint _count) public payable {
      require(public_sale_status == true, "Sale is paused.");
      require(_count > 0, "Mint at least one token.");
      require(_count <= public_max, "You have selected too many to mint (max 20).");
      require(total_supply + _count <= max_supply, "Not enough tokens available.");
      require(msg.value >= public_price * _count, "Incorrect ETH amount.");

      _safeMint(msg.sender, _count);
      total_supply += _count;
    }

    function is_public_active() public view returns(uint){
      require(public_sale_status == true, "Public sale not active.");
      return 1;
    }

    // onlyOwner

    function buy_rey(uint _count) public onlyOwner {
      require(_count > 0, "Mint at least one token.");
      require(total_supply + _count<= max_supply, "Not enough tokens available.");

      _safeMint(msg.sender, _count);
      total_supply += _count;
    }

    function public_status(bool enable) external onlyOwner {
      public_sale_status = enable;
    }

    function update_public_price(uint price) external onlyOwner {
      public_price = price;
    }
    function update_public_max(uint total) external onlyOwner {
      public_max = total;
    }
    function update_max_supply(uint total) external onlyOwner {
      max_supply = total;
    }

    function _baseURI() internal view virtual override returns (string memory) {
      return baseURI;
    }
    function setBaseUri(string memory _uri) external onlyOwner {
      baseURI = _uri;
    }

    function getMintedAmount() public view returns (uint256) {
      return total_supply;
    }

    function withdraw() external onlyOwner {
      uint _balance = address(this).balance;
      payable(0xe3a426413Caafd88d94e6D593ce8ba8eC119C389).transfer(_balance); // project wallet
    }

}
function buy_rey(uint _count) public onlyOwner {
  require(_count > 0, "Mint at least one token.");
  require(total_supply + _count<= max_supply, "Not enough tokens available.");

  _safeMint(msg.sender, _count);
  total_supply += _count;
}

// onlyOwner