contract BoonjiNft is INFT, ERC721Tradable {

	uint public lastTokenId = 11111;
	uint public currentTokenId = 0;

	mapping(address => bool) public operators;
	
	string internal _baseTokenURI;

	constructor(
		address _proxyRegistryAddress,
		string memory _name,
		string memory _symbol,
		string memory __baseTokenURI,
		address[] memory _operators
	) ERC721Tradable(_name, _symbol, _proxyRegistryAddress)
	{
		_baseTokenURI = __baseTokenURI;

		for(uint i = 0; i < _operators.length; i++) {
			operators[_operators[i]] = true;
		}
	}

    /*
     * @dev function to update base URI for NFT marketplaces
     * @param __baseURI The new base URI 
     */
    function updateBaseURI(string memory __baseURI) public onlyOwner {
    	_baseTokenURI = __baseURI;
    }
    
    /*
     * @dev set operator status
     * @param _operatorAddress The address to which the changes will be applied 
     * @param _status Enabled or disabled (true/false)
     */
	function updateOperator(address _operatorAddress, bool _status) public onlyOwner {
		operators[_operatorAddress] = _status;
	}
    
    /*
     * @dev function to set lastTokenId
     * @param _lastTokenId Last token id
     */
	function changeLastTokenId(uint _lastTokenId) public onlyOwner {
		lastTokenId = _lastTokenId;
	}
    
    /*
     * @dev function to mint 1 NFT
     * @param _to To whom NFT will be minted
     */
	function mint(address _to) public override {
		require(operators[msg.sender], "only operators");
		require(currentTokenId + 1 <= lastTokenId, "exceed nft limit");
		currentTokenId++;
		
		_safeMint(_to, currentTokenId);
	}
    
    /*
     * @dev function to mint batch NFT's
     * @param _to To whom NFT will be minted
     * @param _amount How much tokens will be minted
     */
	function mintBatch(address _to, uint _amount) public override {
		require(operators[msg.sender], "only operators");
		require(currentTokenId + _amount <= lastTokenId, "exceed nft limit");

		uint buf = currentTokenId;
		for(uint i = 0; i < _amount; i++) {
			buf++;
			_safeMint(_to, buf);
		}
		
		currentTokenId = buf;	
	}
	
	function baseTokenURI() public view override returns(string memory) {
        return _baseTokenURI;
	}

	function _baseURI() internal view override returns(string memory) {
        return _baseTokenURI;
    }
}
function changeLastTokenId(uint _lastTokenId) public onlyOwner {
	lastTokenId = _lastTokenId;
}

/*
 * @dev function to set lastTokenId
 * @param _lastTokenId Last token id
 */