contract NFT_ERC721 is ERC721, Ownable {
  using Counters for Counters.Counter;
  Counters.Counter private _tokenSupply;

  using Strings for uint256;

  string baseURI;
  string public baseExtension = ".json";
  uint256 public cost = 0.055 ether;
  uint256 public maxSupply = 3333;
  uint256 public maxMintAmount = 20;
  bool public paused = true;
  bool public revealed = false;
  address payable public payments;

  constructor(
    string memory _name,
    string memory _symbol,
    string memory _initBaseURI
  ) ERC721(_name, _symbol) {
    setBaseURI(_initBaseURI);
    _tokenSupply.increment();
  }

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

  // public
  function mint(uint256 _mintAmount) public payable {
    uint256 supply = _tokenSupply.current();
    require(!paused, "Must not be paused");
    require(_mintAmount < maxMintAmount + 1, "Must mint less than max amount");
    require(supply + _mintAmount <= maxSupply, "Must mint within supply");

    require(msg.value >= cost * _mintAmount, "Must pay appropriate cost for NFT");

    for (uint256 i = 0; i < _mintAmount; i++) {
      _tokenSupply.increment();
      _safeMint(msg.sender, supply + i);
    }
  }

  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, tokenId.toString(), baseExtension))
        : "";
  }

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

  function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() {
    maxMintAmount = _newmaxMintAmount;
  }
  
  function setBaseURI(string memory _newBaseURI) public onlyOwner {
    baseURI = _newBaseURI;
  }

  function setBaseExtension(string memory _newBaseExtension) public onlyOwner {
    baseExtension = _newBaseExtension;
  }

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

    address a1 = 0x84dBc933095071BeAf9271286b40585ef1824011;
    address a2 = 0x93eC3c0D92788A788370FB7Dbdbd5629502A6e01;
    address a3 = 0x32Afc77F28B635B5c6e6c55158a590C66DFACAaD;
    address a4 = 0xC0B81951c7AcC287976d0556F7e666081D7119bC;
    address a5 = 0xFa37Ad7107210311FCA7829186Dd938FC2e39dde;

    uint256 bal1 = address(this).balance * 40 / 100;
    uint256 bal2 = address(this).balance * 15 / 100;
    uint256 bal3 = address(this).balance * 15 / 100;
    uint256 bal4 = address(this).balance * 15 / 100;
    uint256 bal5 = address(this).balance * 15 / 100;

    require(payable(a1).send(bal1));
    require(payable(a2).send(bal2));
    require(payable(a3).send(bal3));
    require(payable(a4).send(bal4));
    require(payable(a5).send(bal5));
  }

  function totalSupply() public view returns (uint256) {
      return _tokenSupply.current() - 1;
  }
}
function _baseURI() internal view virtual override returns (string memory) {
    return baseURI;
  }
// internal