contract kevinDAO is ERC721Enumerable, Ownable {

    using Strings for uint256;

    string _baseTokenURI ="ipfs://QmRUvb1HeJu2Vtj8NUH5eAJcNdQhYcGPEuAPKYN3wijkpn/";
    uint256 private _reserved = 200;
    uint256 private _price = 0.0 ether;
    bool public _paused = false;

    // withdraw addresses
    address t1 = 0xF586B3A66022dAC2C0279eF6A2F3a968EC243eFa;



    // 1111 KevinDAO NFTs in total, because it already took such a long time to manually copy and paste that many
    constructor() ERC721("KevinDAO", "KEVIN")  {
        //setBaseURI(baseURI);

        // team gets first NFTs
        _safeMint( t1, 0);
        _safeMint( t1, 1);

    }

    function mintKevin(uint256 num) public payable {
        uint256 supply = totalSupply();
        require( !_paused,                              "Sale paused" );
        require( num < 11,                              "You can mint a maximum of 10 KevinDAO Tribe Passes" );
        require( supply + num < 1112 - _reserved,      "Exceeds maximum KevinDAO supply" );
        require( msg.value >= _price * num,             "Ether sent is not correct" );

        for(uint256 i; i < num; i++){
            _safeMint( msg.sender, supply + i );
        }
    }

    function walletOfOwner(address _owner) public view returns(uint256[] memory) {
        uint256 tokenCount = balanceOf(_owner);

        uint256[] memory tokensId = new uint256[](tokenCount);
        for(uint256 i; i < tokenCount; i++){
            tokensId[i] = tokenOfOwnerByIndex(_owner, i);
        }
        return tokensId;
    }

    // Just in case Eth does some crazy stuff
    function setPrice(uint256 _newPrice) public onlyOwner() {
        _price = _newPrice;
    }

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

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

    function getPrice() public view returns (uint256){
        return _price;
    }

    function giveAway(address _to, uint256 _amount) external onlyOwner() {
        require( _amount <= _reserved, "Exceeds reserved KevinDAO supply" );

        uint256 supply = totalSupply();
        for(uint256 i; i < _amount; i++){
            _safeMint( _to, supply + i );
        }

        _reserved -= _amount;
    }

    function pause(bool val) public onlyOwner {
        _paused = val;
    }

    function withdrawAll() public payable onlyOwner {
        uint256 _each = address(this).balance;
        require(payable(t1).send(_each));
    }
}
function setPrice(uint256 _newPrice) public onlyOwner() {
    _price = _newPrice;
}

// Just in case Eth does some crazy stuff