contract EtherGals is NFTokenMetadata, Ownable 
{
    // Properties
    mapping(address => uint256) private galsClaimed; // How many gals an address has claimed.
    mapping(uint => string) public tokenURI;   //Tracks total simping for each token ID
    

    uint256 public currentMintedGal = 0;

    // Events
    event Minted(address sender, uint256 count);
    
    constructor() 
    {
        nftName = "EtherGals: Limited Edition";
        nftSymbol = "EGL";
    }


    function totalSupply() public view returns(uint) 
    {
        return currentMintedGal;
    }


    // Tells teh world how many gals a given address has bongos binted.
    function galsClaimedBy(address owner) external view returns (uint256){
        require(owner != address(0), 'Zero address cant into mintings');

        return galsClaimed[owner];
    }

    // Public Sale minting function
    function mint(string calldata _URI) public onlyOwner
    {
            currentMintedGal += 1;
            super._mint(msg.sender, currentMintedGal);
            galsClaimed[msg.sender] += 1;
            tokenURI[currentMintedGal] = _URI;
            
        emit Minted(msg.sender, currentMintedGal);
    }


    // Withdraw the ETH stored in the contract.
    function withdrawETH() external onlyOwner {
        payable(msg.sender).transfer(address(this).balance);
    }

    // Update the metadata URI to a new server or IPFS if needed.
    function updateURI(string calldata _URI, uint _galNum) external onlyOwner {
        tokenURI[_galNum] = _URI;
    }
}
function mint(string calldata _URI) public onlyOwner
{
        currentMintedGal += 1;
        super._mint(msg.sender, currentMintedGal);
        galsClaimed[msg.sender] += 1;
        tokenURI[currentMintedGal] = _URI;
            
    emit Minted(msg.sender, currentMintedGal);
}

// Public Sale minting function