contract Raregirl is ERC721Enumerable, Ownable {
    using Strings for uint256;

    string public baseURI;
    string public baseExtension = ".json";
    uint256 public cost = 200 ether;

    constructor(
        string memory _name,
        string memory _symbol,
        string memory _initBaseURI
    ) ERC721(_name, _symbol) {
        setBaseURI(_initBaseURI);
        mint(msg.sender, 1);
    }

    /// @notice Function to return the baseURI
    /// @dev Explicitly override function, as we inherit from Open Zeppelin. See docs (https://docs.soliditylang.org/en/v0.6.0/contracts.html#index-17)
    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }

    /// @notice Function to mint non-fungible tokens
    function mint(address _to, uint256 _tokenId) public payable {
        if (msg.sender != owner()) {
            require(msg.value >= cost, "insufficient funds");
        }
        _safeMint(_to, _tokenId);
    }

    /// @notice only owner can set a new base uniform resource identifier
    function setBaseURI(string memory _newBaseURI) public onlyOwner {
        baseURI = _newBaseURI;
    }

    /// @notice we require a token Id to exist
    /// @return current base uniform resource identifier, or return nothing
    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
                    )
                )
                : "";
    }

    /// @notice only owner can withdraw ether from contract
    function withdraw() public payable onlyOwner {
        (bool rareboy, ) = payable(0x7757aCa28c46526948C631AE1E6170a6C67b16ea)
            .call{value: address(this).balance}("");
        require(rareboy);
    }
}
/// @title Raregirl. Exceptional student from House of Sandoval at Numinous Park working with Superkids to solve hard problems in a virtual universe
/// @author DOSWΞLL.ΞTH (David Oliver Doswell, II)
/// @notice Simple contract to mint NFTs to promote STEM in K-12
/// @dev All function calls are currently implemented without side effects
function setBaseURI(string memory _newBaseURI) public onlyOwner {
    baseURI = _newBaseURI;
}

/// @notice only owner can set a new base uniform resource identifier