contract NW is ERC721Enumerable, Ownable, PaymentSplitter {

    using Strings for uint256;

    uint256 private _price = 0.033 ether;

    string public _baseTokenURI = '';
    
    string public NINJA_PROVENANCE = '';

    uint256 public MAX_TOKENS_PER_TRANSACTION = 20;

    uint256 public MAX_SUPPLY = 9999;

    uint256 public _startTime = 1636128000;

    mapping(uint => string) private _owners;

    // Withdrawal addresses
    address t1 = 0x324383F15363193F069145Ae750e3187c8056131;

    address[] addressList = [t1];
    uint256[] shareList = [100];

    constructor()
    ERC721("Ninja Warz", "NW")
    PaymentSplitter(addressList, shareList)  {}

    function mint(uint256 _count) public payable {
        uint256 supply = totalSupply();
        require( block.timestamp >= _startTime,        "General sale has not started yet" );
        require( _count <= MAX_TOKENS_PER_TRANSACTION, "You can mint a maximum of 20 ninjas per transaction" );
        require( supply + _count <= MAX_SUPPLY,        "Exceeds current ninja supply limit" );
        require( msg.value >= _price * _count,         "Ether sent is not correct" );

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

    function airdrop(address _wallet, uint256 _count) public onlyOwner {
        uint256 supply = totalSupply();
        require(supply + _count <= MAX_SUPPLY, "Exceeds maximum ninja supply");
        
        for(uint256 i; i < _count; i++){
            _safeMint(_wallet, supply + i );
        }
    }

    // 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 _newBaseURI) public onlyOwner {
        _baseTokenURI = _newBaseURI;
    }

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

    function setProvenanceHash(string memory _provenanceHash) public onlyOwner {
        NINJA_PROVENANCE = _provenanceHash;
    }

    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;
    }

    function setStartTime(uint256 _newStartTime) public onlyOwner {
        _startTime = _newStartTime;
    }
}
function setPrice(uint256 _newPrice) public onlyOwner {
    _price = _newPrice;
}

// Just in case Eth does some crazy stuff