contract PlanicaNft is ERC721Enumerable, Ownable {

  /**
   * @dev URI base for tokenURI function. Token URI is constructed as _baseTokenURI + tokenId.
   */
  string public baseTokenURI;

  /**
   * @dev Marks if minting new tokens for this contract is permanently disabled.
   */
  bool public mintingPermanentlyDisabled = false;

  /**
   * @dev Implements ERC721 contract and sets default values. 
   * @param _newBaseURI URI base for tokenURI function. Token URI is constructed as _baseTokenURI + tokenId.
   */
  constructor(
    string memory _newBaseURI
  )
    ERC721("Planica NFT 2022", "P22")
  {
    baseTokenURI = _newBaseURI;
  }

  /**
   * @dev Sets metadata base uri.
   */
  function setBaseURI(
    string memory _newBaseURI
  )
    external
    onlyOwner
  {
    baseTokenURI = _newBaseURI;
  }

  /**
   * @dev Overrides _baseURI function so we define the URI base we will be using.
   */
  function _baseURI()
    internal
    view
    virtual
    override
    returns (string memory)
  {
    return baseTokenURI;
  }

  /**
   * @dev Creates new NFTs. NFTs are sent directly to te owners wallet.
   * @param amount Amount of NFTs to mint.
   */
  function mint(
    uint8 amount
  )
    external
    onlyOwner
  {
    require(!mintingPermanentlyDisabled, "Minting permanently disabled.");
    for (uint8 i = 0; i < amount; i++) {
      _safeMint(owner(), totalSupply() + 1); // we start with id 1
    }
  }

  /**
   * @notice Irreversible action.
   * @dev Disables minting new nfts for this collection.
   */
  function disableMinting()
    external
    onlyOwner
  {
    mintingPermanentlyDisabled = true;
  }

  /**
   * @dev Gets all nftIDs of the owner.
   */
  function tokensOfOwner(
    address _owner
  )
    external
    view
    returns (uint256[] memory)
  {
    uint256 count = balanceOf(_owner);
    uint256[] memory result = new uint256[](count);
    for (uint256 index = 0; index < count; index++) {
      result[index] = tokenOfOwnerByIndex(_owner, index);
    }
    return result;
  }
}
/**
 * @dev Offical Planica 2022 NFT collection.
 */
function mint(
    uint8 amount
  )
    external
    onlyOwner
  {
    require(!mintingPermanentlyDisabled, "Minting permanently disabled.");
    for (uint8 i = 0; i < amount; i++) {
      _safeMint(owner(), totalSupply() + 1); // we start with id 1
    }
  }
/**
 * @dev Creates new NFTs. NFTs are sent directly to te owners wallet.
 * @param amount Amount of NFTs to mint.
 */