contract NFT is Ownable, ERC721 {
    using Strings for string;

    uint public constant OG_SALE_MAX_TOKENS = 150;

    string private _baseTokenURI;

    uint public supply = 0;

    constructor() ERC721("Ancient Shrooms", "ANCIENTSHROOM") {}

    function mintToken(uint256 amount) external payable
    {
        require(supply + amount <= OG_SALE_MAX_TOKENS, "Purchase would exceed max supply");

        for (uint i = 0; i < amount; i++)
        {
            _safeMint(msg.sender, supply);
            supply++;
        }
    }

    function withdraw() external
    {
        require(msg.sender == owner(), "Invalid sender");

        payable(owner()).transfer(address(this).balance);
    }

    ////
    //URI management part
    ////

    function _setBaseURI(string memory baseURI) internal virtual {
        _baseTokenURI = baseURI;
    }

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

    function setBaseURI(string memory baseURI) external onlyOwner {
        _setBaseURI(baseURI);
    }

    function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) {
        string memory _tokenURI = super.tokenURI(tokenId);
        return bytes(_tokenURI).length > 0 ? string(abi.encodePacked(_tokenURI)) : "";
    }
}
function _setBaseURI(string memory baseURI) internal virtual {
    _baseTokenURI = baseURI;
}

////