contract FruitionNFT is
Ownable,
ERC1155
{
    // ================== STATE VARIABLES ==================

    // Constants for ERC20 compatibility
    string public constant name = "FruitionNFT";
    string public constant symbol = "FRU-NFT";


    // ================== EVENTS ==================

    // ================== CONSTRUCTOR ==================

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor()
    ERC1155("https://fruitiondao.github.io/dao-assets/assets/")
    {}

    // ================== VIEW FUNCTIONS ==================

    /*
     * @dev Returns URI for the {_tokenId} passed as parameter to the function.
     */
    function uri(uint256 _tokenId)
    public
    view
    override
    returns (string memory)
    {
        uint256 id = _tokenId;
        bytes memory reversed = new bytes(100);
        uint256 i = 0;
        while (id != 0) {
            reversed[i++] = bytes1(
                uint8((id % 10) + 48)
            );
            id /= 10;
        }

        bytes memory ordered = new bytes(i);
        for (uint256 j = 0; j < i; j++) {
            ordered[j] = reversed[i - j - 1];
        }

        return string(
            abi.encodePacked(
                super.uri(_tokenId),
                string(ordered),
                ".json"
            )
        );
    }

    // ================== MUTABLE FUNCTIONS ==================

    function setURI(string calldata _uri)
    external
    onlyOwner
    {
        _setURI(_uri);
    }

    /*
     * @dev Mints NFT tokens and is only callable by the contract owner.
     */
    function mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) external onlyOwner {
        _mint(
            to,
            id,
            amount,
            data
        );
    }

    /*
     * @dev Allows minting of NFTs in batch and is only callable by contract owner.
     */
    function mintBatch(
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory data
    ) external onlyOwner {
        _mintBatch(
            to,
            ids,
            amounts,
            data
        );
    }

    // ================== INTERNAL FUNCTIONS ==================

    // ================== PRIVATE FUNCTIONS ==================
}
function uri(uint256 _tokenId)
public
view
override
returns (string memory)
{
    uint256 id = _tokenId;
    bytes memory reversed = new bytes(100);
    uint256 i = 0;
    while (id != 0) {
        reversed[i++] = bytes1(
            uint8((id % 10) + 48)
        );
        id /= 10;
    }

    bytes memory ordered = new bytes(i);
    for (uint256 j = 0; j < i; j++) {
        ordered[j] = reversed[i - j - 1];
    }

    return string(
        abi.encodePacked(
            super.uri(_tokenId),
            string(ordered),
            ".json"
        )
    );
}

/*
 * @dev Returns URI for the {_tokenId} passed as parameter to the function.
 */