/**
 * @class   vtkF3DWebPReader
 * @brief   Read a WebP image file
 */
#ifndef vtkF3DWebPReader_h
#define vtkF3DWebPReader_h

#include "vtkImageReader.h"
#include "vtkVersion.h"

class vtkResourceStream;

class vtkF3DWebPReader : public vtkImageReader
{
public:
  static vtkF3DWebPReader* New();
  vtkTypeMacro(vtkF3DWebPReader, vtkImageReader);

  ///@{
  /**
   * Return 1 if, after a quick check of file header, it looks like the provided stream
   * can be read. Return 0 if it is sure it cannot be read as a stream.
   *
   * Only check the header contains "RIFFxxxxWEBP"
   */
  int CanReadFile(const char* fname) override;
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 6, 20260106)
  int CanReadFile(vtkResourceStream* stream) override;
#else
  int CanReadFile(vtkResourceStream* stream);
#endif
  ///@}

  /**
   * List of extensions supported by this reader
   */
  const char* GetFileExtensions() override
  {
    return ".webp";
  }

  /**
   * Descriptive name of the reader
   */
  const char* GetDescriptiveName() override
  {
    return "WebP";
  }

protected:
  vtkF3DWebPReader();
  ~vtkF3DWebPReader() override;

  void ExecuteInformation() override;
  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;

private:
  vtkF3DWebPReader(const vtkF3DWebPReader&) = delete;
  void operator=(const vtkF3DWebPReader&) = delete;

  std::vector<unsigned char> BufferData;
};

#endif
