/**
 * This file is auto-generated by CMake, do not edit directly.
 */

#ifndef F3DNetCDF_h
#define F3DNetCDF_h

#include "reader.h"

#include "F3DUtils.h"

#if 1
#include <vtkNetCDFReader.h>
#endif

#if 0
#include <.h>
#endif

#include <vtkMemoryResourceStream.h>
#include <vtkVersion.h>
#include <vtksys/SystemTools.hxx>

class reader_NetCDF : public f3d::reader
{
public:
  reader_NetCDF()
  {
    this->ReaderOptions = {  };
  }

  /*
   * Get the name of this reader
   */
  const std::string getName() const override { return "NetCDF"; }

  /*
   * Get the short description of this reader
   */
  const std::string getShortDescription() const override { return "NetCDF"; }

  /*
   * Get the extensions supported by this reader
   */
  const std::vector<std::string> getExtensions() const override
  {
    static const std::vector<std::string> ext = { "nc", "cdf", "ncdf" };
    return ext;
  }

  /*
   * Get the mimetypes supported by this reader
   */
  const std::vector<std::string> getMimeTypes() const override
  {
    static const std::vector<std::string> types = { "application/netcdf", "application/x-netcdf" };
    return types;
  }

#if 1
  /*
   * Get the score of this reader.
   * The score is used in case several readers are able to read the file.
   * The reader having the highest score (from 0 to 100) is used to read the file.
   * Default is 50.
   */
  int getScore() const override
  {
    return 40;
  }
#endif

#if 1
  /**
   * Return true if this reader can create a geometry reader
   * false otherwise
   */
  bool hasGeometryReader() override
  {
    return true;
  }

  using f3d::reader::createGeometryReader;

  /*
   * Create the geometry reader (VTK reader) for the given filename
   * The filename is collapsed as some VTK reader needs it to read reliably TODO add issue
   */
  vtkSmartPointer<vtkAlgorithm> createGeometryReader(const std::string& fileName) const override
  {
    vtkNew<vtkNetCDFReader> geomReader;
    geomReader->SetFileName(vtksys::SystemTools::CollapseFullPath(fileName).c_str());

    this->applyCustomReader(geomReader, fileName, nullptr);

    return geomReader;
  }

#if 0
  /*
   * Create the geometry reader (VTK reader) for the given stream
   */
  vtkSmartPointer<vtkAlgorithm> createGeometryReader(vtkResourceStream* stream) const override
  {
    vtkNew<vtkNetCDFReader> geomReader;
    geomReader->SetStream(stream);

    this->applyCustomReader(geomReader, "", stream);

    return geomReader;
  }

#endif
#endif

#if 0
  /**
   * Return true if this reader can create a scene reader
   * false otherwise
   */
  bool hasSceneReader() override
  {
    return true;
  }

  using f3d::reader::createSceneReader;
  /*
   * Create the scene reader (VTK importer) for the given filename
   * The filename is collapsed as some VTK reader needs it to read reliably TODO add issue
   */
  vtkSmartPointer<vtkImporter> createSceneReader(const std::string& fileName) const override
  {
    vtkNew<> importer;
    importer->SetFileName(vtksys::SystemTools::CollapseFullPath(fileName).c_str());

    this->applyCustomImporter(importer, fileName, nullptr);

    return importer;
  }

#if 0
  /*
   * Create the scene reader (VTK importer) for the given stream
   */
  vtkSmartPointer<vtkImporter> createSceneReader(vtkResourceStream* stream) const override
  {
    vtkNew<> importer;
    importer->SetStream(stream);

    this->applyCustomImporter(importer, "", stream);

    return importer;
  }
#endif
#endif

  using reader::canRead;
#if 0
  /**
   * Return true if this reader supports stream
   * false otherwise
   */
  bool supportsStream() const override
  {
    return true;
  }

#if 0 || 0
  /**
   * Return true if this reader could be able to read provided stream,
   * false if it is sure it cannot.
   */
  bool canRead([[maybe_unused]] vtkResourceStream* stream) const override
  {
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 6, 20260128)
#if 0
    return vtkNetCDFReader::CanReadFile(stream);
#else // CAN_READ
    vtkNew<vtkNetCDFReader> object;
    return object->CanReadFile(stream);
#endif // F3D_READER_STATIC_CAN_READ
#else // VTK_VERSION
    return true;
#endif // VTK_VERSION
  }
#endif //STATIC OR MEMBER
#else // SUPPORTS_STREAM
  bool canRead(vtkResourceStream* vtkNotUsed(stream)) const override
  {
    // SUPPORTS_STREAM not enabled, so fast content validation should always return true
    return true;
  }
#endif // SUPPORTS_STREAM

#if 1
#include "/build/f3d/src/f3d-3.5.0/plugins/hdf/netcdf.inl"
#endif // F3D_READER_HAS_CUSTOM_CODE

};

#endif
