contract BabyDinosNFTToken is ERC721Enumerable, Ownable, Royalties, MinterRole {
    using Strings for uint256;
    using SafeMath for uint256;

    string public baseExtension = ".json";
    string public baseURI = "https://thumbnail-egg-collections.s3.us-east-2.amazonaws.com/";

    struct RenderToken {
        uint256 id;
        string uri;
    }

    event Mint(address indexed to, uint256 indexed tokenId);

    constructor(
        string memory _name,
        string memory _symbol,
        uint256 _amount,
        address payable _creator
    ) ERC721(_name, _symbol) Royalties(_amount, _creator) {}

    function mint(
        address _to,
        uint256 _mintAmount
    ) public onlyMinter returns (bool) {
        require(_mintAmount > 0, "BabyDinosNFTToken: mintAmount should be > 0");
        uint256 supply = totalSupply();

        for (uint256 i = 1; i <= _mintAmount; i++) {
            _safeMint(_to, supply + i);
            emit Mint(_to, supply + i);
        }

        return true;
    }

    function walletOfOwner(address _owner)
        public
        view
        returns (uint256[] memory)
    {
        uint256 ownerTokenCount = balanceOf(_owner);
        uint256[] memory tokenIds = new uint256[](ownerTokenCount);
        for (uint256 i; i < ownerTokenCount; i++) {
            tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
        }
        return tokenIds;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "BabyDinosNFTToken: URI query for nonexistent token"
        );

        string memory currentBaseURI = _baseURI();
        return
            bytes(currentBaseURI).length > 0
                ? string(
                    abi.encodePacked(
                        currentBaseURI,
                        tokenId.toString(),
                        baseExtension
                    )
                )
                : "";
    }

    function setBaseURI(string memory _newBaseURI) public onlyOwner {
        baseURI = _newBaseURI;
    }

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

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

// internal