contract Trevortrips is ERC721, Ownable {
    using Strings for uint256;
    string public baseURI;
    uint256 public cost = 0.06 ether;
    uint256 public maxSupply = 10000;
    uint256 public maxMintAmount = 10;
    uint256 public tokenCount = 0;
    bool public paused = false;

    mapping(address => uint256) public addressMintedBalance;

    constructor(string memory _initBaseURI)
        ERC721("Trevortrips", "TREVORTRIPS")
    {
        baseURI = _initBaseURI;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(_exists(tokenId), "ERC721Metadata: Token ID does not exist");
        return
            bytes(baseURI).length > 0
                ? string(
                    abi.encodePacked(baseURI, "/", tokenId.toString(), ".json")
                )
                : "";
    }

    function mint(uint256 _amount) external payable {
        require(!paused, "The Contract is Paused");
        require(
            tokenCount + _amount <= maxSupply,
            "Trevortrips - max NFT limit exceeded"
        );
        if (msg.sender != owner()) {
            require(
                _amount <= maxMintAmount,
                "Trevortrips - max mint amount limit exceeded"
            );
            require(
                msg.value >= cost * _amount,
                "Trevortrips - insufficient ethers"
            );
        }
        for (uint256 i = 1; i <= _amount; i++) {
            addressMintedBalance[msg.sender]++;
            _safeMint(msg.sender, ++tokenCount);
        }
    }

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

    function pause() public onlyOwner {
        paused = !paused;
    }

    function withdraw() public onlyOwner {
        (bool os, ) = payable(owner()).call{value: address(this).balance}("");
        require(os);
    }
}
function setCost(uint256 _newCost) public onlyOwner {
        cost = _newCost;
    }
//only owner