#pragma once

#include "office/ExcelWrapper.h"

#include "ccl/rslang/SDataCompact.h"

namespace xtr::io {

//! RSModel data exchange
class RSMDataX {
protected:
  MSO::Excel::ExcelWrapper xlWrapper{};
  MSO::Excel::EXLWorkbook workingWb{ nullptr };
  MSO::Excel::EXLWorksheet workingWs{ nullptr };

public:
  RSMDataX(const RSMDataX&) = delete;
  RSMDataX& operator=(const RSMDataX&) = delete;

protected:
  ~RSMDataX() = default;
  RSMDataX() = default;

public:
  [[nodiscard]] static RSMDataX& Instance();

  static BOOL ExportModel(const ccl::semantic::RSModel& model);
  static BOOL ExportDataFor(EntityUID target, const ccl::semantic::RSModel& model);

  [[nodiscard]] static std::optional<ccl::object::SDCompact>
    ImportStructured(const ccl::semantic::RSModel& model, const ccl::rslang::Typification& structure);
  [[nodiscard]] static std::optional<ccl::semantic::TextInterpretation>
    ImportText(const ccl::semantic::RSModel& model);
};

} // namespace xtr::io