contract BeatHiveVIPPass is ERC1155, Ownable {
    using Strings for uint256;
    string public name;
    string public symbol;
    string private baseURI = 'https://beathive.nftapi.art/meta/';
    uint256 public cost = 0.1 ether;
    uint256 private nowMinting = 1;
    uint256 public supply = 1000;
    mapping(uint256 => uint256) private _totalSupply;
    address pagzi = 0xeBaBB8C951F5c3b17b416A3D840C52CcaB728c19;
    address beathive = 0x08C4520808D662adc485dD607dF528BA192BBf34;
    address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;

    constructor() ERC1155("https://beathive.nftapi.art/meta/") {
        name = "Beat Hive VIP PASS";
        symbol = "BHVIP";
        _mint(beathive,1,50,"");
        _totalSupply[nowMinting] = 50;
	}

    /// Public Functions ///
    function mint(uint256 amount) external payable {
		require((_totalSupply[nowMinting] + amount) < supply,"OUT");
		require(msg.value >= cost * amount,"LOW");
        _mint(msg.sender, nowMinting, amount, "");
        _totalSupply[nowMinting] += amount;
    }
    function burn(address account, uint256 _tokenId, uint256 value) public virtual {
        require(account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved");
        _burn(account, _tokenId, value);
        _totalSupply[_tokenId] -= value;
    }
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply[nowMinting];
    }
    function totalSupply(uint256 _tokenId) public view virtual returns (uint256) {
        return _totalSupply[_tokenId];
    }
    function uri(uint256 _tokenId) public view override returns (string memory)
    {
        require(totalSupply(_tokenId)>0, "Token does not exist.");
        return string(abi.encodePacked(baseURI, Strings.toString(_tokenId)));
    }
    function tokenURI(uint256 _tokenId) public view returns (string memory) {
        require(totalSupply(_tokenId)>0, "Token does not exist.");
        return string(abi.encodePacked(baseURI, Strings.toString(_tokenId)));
    }
    function isApprovedForAll(address _owner, address operator) public view override returns (bool) {
        OpenSeaProxyRegistry proxyRegistry = OpenSeaProxyRegistry(proxyRegistryAddress);
        if (address(proxyRegistry.proxies(_owner)) == operator) return true;
        return super.isApprovedForAll(_owner, operator);
    }
    /// Owner Functions ///
    function updateBaseUri(string calldata base) external onlyOwner {
        baseURI = base;
    }
    function setCost(uint256 _cost) external onlyOwner {
		cost = _cost;
    }
    function setNowMinting(uint256 _minting) external onlyOwner {
		nowMinting = _minting;
    }
    function setSupply(uint256 _supply) external onlyOwner {
		supply = _supply;
    }
    function setProxyRegistryAddress(address _proxyRegistryAddress) external onlyOwner {
        proxyRegistryAddress = _proxyRegistryAddress;
    }
    function withdraw() public onlyOwner {
        uint256 balance = address(this).balance;
        payable(pagzi).transfer((balance * 150) / 1000);
        payable(beathive).transfer((balance * 850) / 1000);
    }
}
/* import "@openzeppelin/contracts/access/Ownable.sol"; */
function mint(uint256 amount) external payable {
		require((_totalSupply[nowMinting] + amount) < supply,"OUT");
		require(msg.value >= cost * amount,"LOW");
        _mint(msg.sender, nowMinting, amount, "");
        _totalSupply[nowMinting] += amount;
    }
/// Public Functions ///