// SPDX-License-Identifier: MIT
pragma solidity >=0.4.23 <0.9.0;

import "AdminControl.sol";

contract NFTRegistry is AdminControl {

    /* ========== Structs and Mappings ========== */

    struct Token {
        address tokenAddress;
        string tokenName;
        uint256 tokenFee;
        uint maxTokensToMint;
    }

    mapping(uint => Token) private tokens;

    /* ========== Registry: Search, Add Token, Remove Token ========== */

    function getToken(uint tokenId) public view returns (address, string memory, uint256, uint) {
        Token storage token = tokens[tokenId];
        if (token.tokenAddress == address(0)) {
            return (address(0), "NFT not found", 0, 0);
        }
        return (token.tokenAddress, token.tokenName, token.tokenFee, token.maxTokensToMint);
    }

    function setToken(uint tokenId, address tokenAddress, string memory tokenName, uint256 tokenFee, uint maxTokenMint) external adminRequired {
        Token storage token = tokens[tokenId];
        token.tokenAddress = tokenAddress;
        token.tokenName = tokenName;
        token.tokenFee = tokenFee;
        token.maxTokensToMint = maxTokenMint;
    }

    function removeToken(uint tokenId) external adminRequired {
        Token storage token = tokens[tokenId];
        if (token.tokenAddress == address(0)) {
            revert("Token not found");
        }
        delete tokens[tokenId];
    }
}

// End of contract
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"removeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"uint256","name":"tokenFee","type":"uint256"},{"internalType":"uint256","name":"maxTokenMint","type":"uint256"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]